开发者

Limiting query_posts in Wordpress, but still having pagination

开发者 https://www.devze.com 2023-04-07 08:47 出处:网络
I really hope someone can help me.Basically I have a Wordpress site I am using as an affiliate site.I have about 1/2 million posts, which are essentially the products.The site is running fine, except

I really hope someone can help me. Basically I have a Wordpress site I am using as an affiliate site. I have about 1/2 million posts, which are essentially the products. The site is running fine, except for on the category pages where there are more than 5,000 posts. If someone was searching for a product they probaby wouldn't go past page 10 in the search results, so What I'd like to do is limit the query_posts results returned to 500 posts. But still have 25 posts pe开发者_高级运维r page. Does anyone know if this possible?


you mean this code

 <?php $args = array( 'numberposts' => 10, 'order'=> 'ASC', 'orderby' => 'title' );
                $postslist = get_posts( $args );
                foreach ($postslist as $post) :  setup_postdata($post); ?> 
0

精彩评论

暂无评论...
验证码 换一张
取 消