开发者

I added a wp-query in front of my loop but it disables any pagination

开发者 https://www.devze.com 2023-02-09 14:14 出处:网络
I\'m using the Showtime wordpress开发者_StackOverflow theme which builds a blog based on a single category.

I'm using the Showtime wordpress开发者_StackOverflow theme which builds a blog based on a single category.

I modified it and added a query_posts('cat='.$category_id.''.$temp.'&posts_per_page='.get_option('posts_per_page')); in front of the loop to get multiple categories back.

However, this query disables pagination and makes every page the same posts.

I guess i would have to modify the orignal wp-query the theme uses? Where is it usually located as I cannot find it?

Thanks


I ended up doing this:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('cat='.$category_id.''.$temp.'&paged='.$paged.'&posts_per_page='.get_option('posts_per_page')); // choose which category posts are shown


Try adding

wp_reset_query();

After you loop on your query_posts

0

精彩评论

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