相关文章代码-wordpress主题

相关的10篇文章

    < ?php $tags = wp_get_post_tags($post->ID); if ($tags) { $first_tag = $tags[0]->term_id; $args=array( 'tag__in' => array($first_tag), 'post__not_in' => array($post->ID), 'showposts'=>10, 'caller_get_posts'=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?>
  • < ?php the_title(); ?> < ?php comments_number(' ','(1)','(%)'); ?>
  • < ?php endwhile; } } ?>

由于插件的原因,复制后请修改php代码把< ?php修改< ?php,以方便使用。特注明此代码适用于侧边栏,如使用在single页文章一下的话,建议使用WordPress Related Posts插件!因为此代码会一起评论页标题的错误!

相关文章

发表评论

2 评论.

  1. 请问这个代码放sigle页面么?

    放进去怎么无效啊?

    [回复]

    graygift 回复:

    这个插件把< ?php 给改成了< ?php 所以要改一改

    [回复]

评论


[ Ctrl + Enter ]