<?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显示当前文章同分类下的文章列表》的一些看法。更多内容请查看本栏目更多内容!
wordpress头部的代码十分多,包括WordPress版本,前后文、第一篇文章、主页meta信息等各种冗余代码,这些对...
次要出于两个目的,第一搜集比便大家和当前学习回顾;第二,从根底做一些适用的,添加搜寻量,进步博客流量...
民间引见: 1,经过插件能够创立adsense广告位。 2,能够间接经过工具在网管中心验证网站。 之前站长David...
办法一:应用<!--more-->标签来自在的截取字数 在模板中应用the_content()函数来打印内容,在文章中经过点击...
(如下图),民间的称号叫admin bar,中文咱们就把它叫做治理工具栏吧,也有称之为治理工具条、快捷链接栏的...
获取特定分类文章数 有时分咱们想获取某个分类(category)下的文章数目,以便在博客的某个中央显示进去。上面...