用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(); ?>"><?php the_title(); ?></a></li> <?php endwhile; else : ?> <li>暂无文章</li> <?php endif; wp_reset_query(); } ?>
wordpress利用TAG标签的ID来获取这个标签下的所有文章
上面是“wordpress调用当前分类下所有文章(代码介绍)”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_2407.html
workflows工作流
一个十几岁的美国女孩穿着黄色连帽衫在黑暗和空虚的背景下闲逛
强大的长袍法师ComfyUI工作流
奋斗的小黄人ComfyUI工作流
一座生动的点彩主义灯塔ComfyUI工作流
羚羊安上小白兔的门牙ComfyUI工作流
一套可爱的动漫生物蓬松贴纸图标
树上挂着一只快乐的荔枝ComfyUI工作流
斗鸡场威武雄鸡ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!