<?php
/*
single page?show current category articles
*/
?>
<?php
if ( is_single() ) :
global $post;
$categories = get_the_category();
foreach ($categories as $category) :
?>
<li class="widget widget_recent_entries" id="<?php $category->term_id;?>-posts">
<h2 class="widgettitle"><?php echo $category->name; ?></h2>
<ul>
<?php
$posts = get_posts('numberposts=5&category='. $category->term_id);
foreach($posts as $post) :
?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php
endforeach; endif ; ?>
<?php
/*
end show current category articles
*/
?>
以上就是安达网络工作室关于《WordPress显示当前文章同分类下的文章列表》的一些看法。更多内容请查看本栏目更多内容!
函数is_singular()检测后果为true,当上面其一前往true时:is_single()、is_page()、is_attachment()。 假如...
Fatal error: Call to undefined method wpdb_2::delete() in /home/*/public_html/wp-includes/o...
小洞不补大洞享乐。关于bloggers来说这是永恒的真谛,仅仅花一点工夫在马上就晋级上省下了很多之后修复一些...
query posts是一个十分好用的调用文章函数,能够做到同页面内显示多种特定范畴的文章,例如能够调用某分类、...
我要对文章进行排序,依照投票数的多少排,曾经投票的都会记载投票数,而没有投票的文章没有记载,默许投票...
关于日拜访量还不错的WordPress网站来说,一定都会存在很多待审核的渣滓评论,假如要经过WP后盾删除,那几乎...