所以我正在使用以下代码:
<?php
$args = array('posts_per_page'=>4, 'offset'=>1);
$the_query = new WP_Query($args);
if (have_posts()) : while ( have_posts() ) : the_post();
endwhile;endif; wp_reset_postdata();?>
但是似乎我的数组被完全忽略了。怎么了?
#1
$the_query = get_posts( $args );
它应该工作并使用foreach而不是一会儿。这应该可以解决你的问题。
#2
如果在Ajax中使用, 则可以尝试添加post_status =>” publish”进行查询。
来源:
https://www.srcmini02.com/63782.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_41678.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57