欢迎来到路由器窝!

wordpress调用指定分类置顶文章

浏览次数:

作者: 小编

信息来源:

更新日期: 2024-03-07 16:40

文章简介

<?php$args = array( 'post_type' => 'post', 'showposts' => 3, 'orderby' =>

  • 正文开始
  • 相关文章
<?php
$args = array(
    'post_type' => 'post',
    'showposts' => 3,
    'orderby' => 'rand',
    'post__in' => get_option('sticky_posts'),//获取置顶文章
    'cat' => array(8),//指定分类id);?><?php
    $catquery = new WP_Query($args);
    while($catquery->have_posts()) : $catquery->the_post();?><li class="rowNewsLi"><h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4></li><?php the_content(); ?><?php endwhile; ?>


转载请注明:Wordpress» wordpress调用指定分类置顶文章

标签:
上一页:WordPress父分类调用子分类名称和文章列表
下一页:WordPress 下载功能【Advanced Custom Fields PRO自定义字段文件下载调用
最近更新作品
acf判断
更新时间:2024-04-17

891人已经看过了!

指定栏目ID另类调用配合acf
更新时间:2024-04-16

857人已经看过了!

word press 自定义文章类型制作留言功能
更新时间:2024-03-10

985人已经看过了!

php if  ifelse 循环
更新时间:2024-03-09

575人已经看过了!

栏目模板选择插件栏目模板
更新时间:2024-03-08

738人已经看过了!

contact-form-7历史版本WP SMTP配合使用
更新时间:2024-03-08

809人已经看过了!

WordPress True / False功能参数
更新时间:2024-03-08

928人已经看过了!

wordpress调用指定分类置顶文章
更新时间:2024-03-07

519人已经看过了!

WordPress父分类调用子分类名称和文章列表
更新时间:2024-03-07

518人已经看过了!