I have created a popular post page template for a theme that is under development. I plan to sort the posts by popularity based on page views. I have the page view tracking setup in custom fields for the posts and I even have a query string that retrieves the most popular posts in order successfully. On the first actual popular posts page it displays as it should.
The problem I am having is that when you click to view the next page of popular posts using the pagination, it displays the same popular posts from the first page. Example: page “domain.com/popular” shows the top five popular posts, page “domain.com/popular/page/2” shows the same top five popular posts as the first page, and so on. The query isn’t recognizing the pagination.
I am no PHP or database expert so I am at a loss for what is going wrong here. My last resort will be to limit the popular posts page to a set number of posts, removing pagination. Here is the query in place before the loop…
<? query_posts('meta_key=post_views_count&orderby=meta_value_num&order=DESC&posts_per_page=5'); ?><?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Any help, suggestions, or insight from more knowledgeable coders would be greatly appreciated.
- The topic ‘Popular Post Page Template Query Post Pagination Problem’ is closed to new replies.