Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Pagination on a Search Page

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Adam Peet
    #251413

    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

    Trevor Moderator
    #251465

    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.

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.