本文作者:温文曦

wordpress调用文章数量numberposts

温文曦 2021-08-17 1079 抢沙发
wordpress调用文章数量numberposts摘要:         在调用文章时,如果不指定numberposts数量,默认为5,如果指定了一定数量,那...

        在调用文章时,如果不指定numberposts数量,默认为5,如果指定了一定数量,那么就调用指定的条数。如果想要调用所有,那么指定为-1即可。如下:

$relates = get_posts(array(
    'post_type' => 'propertyawardwinners', 
    'numberposts' => -1, 
    'tax_query' => array(
    array(
        'taxonomy' => 'country',
        'field' => 'slug',
        'terms' => array($tax_country),
        'include_children' => false
    )
  )
));


文章版权及转载声明

作者:温文曦本文地址:https://www.wxnotes.com/blog/619.html发布于 2021-08-17
文章转载或复制请以超链接形式并注明出处文曦博客

赞(4)
阅读
分享

发表评论

快捷回复:

评论列表 (暂无评论,1079人围观)参与讨论

还没有评论,来说两句吧...