wp_query and pagination
-
Hi to all. I know my topic is already discussed in forum, but none of solutions i’ve read worked for me. I’ve spent many hours to search but i cannot resolve. I have a loop with wp_query and i cannot paginate it.
global $wp_query; $cat_id = get_query_var('cat'); $category_name=get_the_category_by_ID($cat_id); $category_link = get_category_link($cat_id);
Then i call the wp_query
$paged=get_query_var('paged'); $my_query = new WP_Query('cat='.$cat_id.'&posts_per_page=60&paged=$paged');
Then the loop and lastly i call the pagination functions:
next_posts_link('Next posts', $my_query->max_num_pages); previous_posts_link('Previous posts', $my_query->max_num_pages);
Then reset the data for other queries
wp_reset_postdata();
This code seems right for me: but don’t work. On my server(localhost:8888) i have a 404 page (page not found) when i click on pagination links. On the domain of the site instead of 404 page it show always the same posts by clicking on pagination links.
I cannot understand the problem. Please someone help me i’m getting crazy with this.
Thank to all and excuse me for my bad english
- The topic ‘wp_query and pagination’ is closed to new replies.