- This topic has 1 reply, 2 voices, and was last updated 6 years, 1 month ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Pagination on a Search Page
Tagged: pagination
Hello,
I am having issues getting pagination on a search template page. I have used the following code to get pagination working on my custom post archives.
$foundationPosts = new WP_Query(array
(‘paged’=> get_query_var(‘paged’,1),
‘post_type’ => ‘how_to_videos’,
<?php echo paginate_links(array(
‘total’ => $foundationPosts ->max_num_pages
)); ?>
I am not sure how to do this on the search template php file. Any help would be appreciated.
Thanks,
Adam
Try something a lot simpler to start with, like this:
<div class="pagination">
<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
</div>
This assumes that your main query results array is called $query
This code does not run an extra query, as you can see.