コード例 #1
0
ファイル: header.php プロジェクト: Germey/xjdssyzx
if (is_home()) {
    if (get_option('hui_description')) {
        $huidesc = get_option('hui_description');
    }
} elseif (is_single()) {
    $huidesc = hui_excerpt(200);
    if ($post->post_excerpt) {
        $huidesc = $post->post_excerpt;
    }
} elseif (is_category() || is_tag()) {
    if (category_description()) {
        $huidesc = strip_tags(category_description());
    }
} elseif (is_page()) {
    if (the_content()) {
        $huidesc = hui_excerpt(200);
    }
}
$huidesc = DeleteHtml($huidesc);
if ($huidesc) {
    echo '<meta name="description" content="' . $huidesc . '" />';
}
?>

<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="<?php 
bloginfo('stylesheet_url');
?>
" type="text/css" media="screen" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php 
コード例 #2
0
ファイル: index.php プロジェクト: Germey/xjdssyzx
function cmsList($list_cat_name, $hCount, $lCount, $word)
{
    $list_cat_ID = get_cat_ID(get_option($list_cat_name));
    $first_args = array('category__in' => $list_cat_ID, 'showposts' => 1, 'post_status' => 'publish');
    $first_post = new WP_Query($first_args);
    while ($first_post->have_posts()) {
        $first_post->the_post();
        ?>
    <header>
		<?php 
        if (has_post_thumbnail()) {
            ?>
			<a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_post_thumbnail(array(95, 95));
            ?>
</a>
		<?php 
        } elseif (catch_that_image()) {
            ?>
            <a href="<?php 
            the_permalink();
            ?>
"><img src="<?php 
            echo catch_that_image();
            ?>
" alt="<?php 
            the_title();
            ?>
" width="96" height="96" /></a>
        <?php 
        } else {
            ?>
            <a href="<?php 
            the_permalink();
            ?>
"><img src="<?php 
            bloginfo('template_url');
            ?>
/images/default-thumbnail.gif" alt="暂无文章缩略 width="96" height="96" /></a>
        <?php 
        }
        ?>
        <h2><a href="<?php 
        the_permalink();
        ?>
" rel="bookmark"><?php 
        echo mb_strimwidth(the_title_attribute('echo=0'), 0, $hCount, '...');
        ?>
</a></h2>
        <p><?php 
        echo hui_excerpt($word);
        ?>
<span class="detailed"><a href="<?php 
        the_permalink();
        ?>
">详细&raquo;</a></span></p>
	</header>
<?php 
    }
    $args = array('category__in' => $list_cat_ID, 'showposts' => 5, 'post_status' => 'publish', 'offset' => 1, 'post__not_in' => get_option('sticky_posts'));
    $recent = new WP_Query($args);
    echo '<ul>';
    while ($recent->have_posts()) {
        $recent->the_post();
        ?>
	<li><a href="<?php 
        the_permalink();
        ?>
" rel="bookmark"><?php 
        echo mb_strimwidth(the_title_attribute('echo=0'), 0, $lCount, '...');
        ?>
</a><time datetime="<?php 
        the_time('Y-m-d');
        ?>
" pubdate><?php 
        the_time('Y-m-d');
        ?>
</time></li>
<?php 
    }
    echo '</ul>';
}