任何人都可以帮助解决这个问题。我需要限制发布在wp_query
。如何在wp_query中限制帖子
我知道如何限制后在wp_query
例如,如果该页面ID是20,我正在查询:
function wpcodex_filter_main_search_post_limits($limit, $query) {
if (get_the_ID()==20) {
return 'LIMIT 0, 12';
}
return $limit;
}
add_filter('post_limits', 'wpcodex_filter_main_search_post_limits', 10, 2);
但我需要的LIMT设置为25〜35。
如何做到这一点?
即使我将返回'LIMIT 25, 35';
仍呈现前35级的产品,而不是25之间的职位,以35
查询是这样的:LIMIT 10 OFFSET 15
请帮助我。
看看这个https://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination你需要使用偏移和分页每页帖子等etc ... –
我看到'showposts'=> 2000,'post_status'\t \t =>'publish', 'offset'=> 11。但它不起作用。我看到这个。我可以更改抵消10,这是分页号码和showpost显示多少帖子显示。但我不知道它为什么不起作用。 – Oscar