添加相关文章和评论
文章标题:
<?php the_title_attribute(); ?>
作者:<?php the_author_posts_link(); ?>;
发布日期:<?php the_date_xml(); ?>;
(用到插件wp-postviews)查看次数:<?php the_views();?>
摘要代码:
<?php echo mb_strimwidth(strip_tags(apply_filters(‘the_content’, $post->post_content)), 0, 200,”……”); ?>
内容代码:
<?php the_content(“Read More…”); ?>
循环代码:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
【上一篇】: <?php previous_post_link(‘%link’); ?>
【下一篇】: <?php next_post_link(‘%link’); ?>
相关文章:
<?php
$cats = wp_get_post_categories($post->ID);
if ($cats) {
$cat = get_category( $cats[0] );
$first_cat = $cat->cat_ID;
$args = array(
‘category__in’ => array($first_cat),
‘post__not_in’ => array($post->ID),
‘showposts’ => 5,
‘caller_get_posts’ => 1
);
query_posts($args);
if (have_posts()) :
while (have_posts()) : the_post(); update_post_caches($posts); ?>
<li>* <a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><?php the_title(); ?></a></li>
<?php endwhile; else : ?>
<li>* 暂无相关文章</li>
<?php endif; wp_reset_query(); } ?>
评论调用:
<?php comments_template(); ?>
原文链接:https://i.haogew.cn/194.html,转载请注明出处~~~
评论0