dede后台模板导读:seo建站技术seo建站技术使用WordPress搭建网站的时候往往都需要获取当前文章所属分类下所有文章列表,方便网站用户点击,那么WordPress如何获取当前文章所属分类下的所有文章?网站搭建it技术网站。
使用WordPress搭建网站的时候往往都需要获取当前文章所属分类下所有文章列表,方便网站用户点击,那么WordPress如何获取当前文章所属分类下的所有文章?
????????<?php
????????$singleurl?=?get_permalink($post_id);
????????$cats?=?wp_get_post_categories($post->ID);
????????if?($cats)?{
????????$args?=?array(
????????'category__in'?=>?array(?$cats[0]?),
????????'showposts'?=>?50,
????????'caller_get_posts'?=>?1
????????);
????????query_posts($args);
????????if?(have_posts())?:
????????while?(have_posts())?:?the_post();?update_post_caches($posts);??>
????????<li<?php?if(get_permalink($post_id)==$singleurl){?>?class="video-curry"<?php?}?>><a?href="<?php?the_permalink();?>"?title="<?php?the_title();??>"><?php?the_title();?></a></li>
????????<?p织梦模板免费下裁hp?endwhile;?else?dede模板免费:??>
暂无
????????<?php?endif;?wp_reset_query();?}??>
通过以上的代码,我们可以在网站内容页面,调用文章所属当前分类下的所有文章列表。
相关网站搭建it技术网站。
关键词标签: 建站 文章 div
声明: 本文由我的SEOUC技术文章主页发布于:2023-07-23 ,文章WordPress如何获取当前文章所属分类下的所有文章主要讲述文章,div,建站网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: http://www.tngdez.cn/article/web_35240.html