<?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 4.1 正式版公布,这次更新带来了2015主题(Twenty Fifteen),免干扰写作模式,暗藏各种芜杂以及...
在 WordPress 中加载脚本(为 CSS 和 JS,下同)文件,大少数人的做法是间接在 header.php 文件中增加 link...
本文实例讲述了wordpress首页不显示指定分类文章的办法。分享给大家供大家参考。详细剖析如下: 有时咱们不...
要害字形容:心得 建站 应用 菜鸟 能够 这个 边栏 主题 文章 一个 这一周都在学用wordpress来做独立博...
此时假如上传一个不在预约义的平安扩大名列表,如.lrc,会报错: File type does not meet security guidel...
1.增加性能 在function.php中拔出代码 add_theme_support('post-thumbnails'); 拔出之后会在后盾编辑文章的...