Home>Support>Query results – Page navigation

Query results – Page navigation

Hello,
I’ve made a custom search for my website and I want the results to be paginated.
The code is:

$args = array(
's' => $keyword,
'orderby' => 'title',
'post_type' => 'any',
'order' => 'ASC',
'posts_per_page' => '10',
'paged' => $paged,
);
?>

Search Results for:

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 3 months ago George D.

    Looks like the code wasn’t displayed. I try again:

    $args = array(
    	's' => $keyword,
    	'orderby' => 'title',
    	'post_type' => 'any',
    	'order'   => 'ASC',
    	'posts_per_page' => '10',
    	'paged' => $paged,
    );
    ?>
    
    			<h2 >Search Results for: <?php echo $keyword; ?></h2>
    		
    <?php	
    $the_query = new WP_Query( $args ); ?>
    
    <?php if ( $the_query->have_posts() ) : ?>
    
    	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    		<li>
    			<a class="title-home" href="<?php the_permalink(); ?>"><span class="title-home"><?php the_title(); ?></span></a>
    		</li>
    		<?php endwhile; ?>
    
    		<?php vantage_content_nav( 'nav-below' ); ?>
    
    	<?php wp_reset_postdata(); ?>
    
    <?php else : ?>
    	<?php _e( 'Sorry, no articles matched your criteria.' ); ?>
    
    
    <?php endif; ?>
    
  2. 9 years, 3 months ago George D.

    The results appear OK but the pagination links doesn’t show up.
    What am I doing wrong?
    Thank you,
    George D.

  3. 9 years, 2 months ago Magus
    Hi, I Work Here

    Hi George

    It may be that you are not passing the paging info in the post arguments. Please see the answer to this post.

    http://wordpress.stackexchange.com/questions/120407/how-to-fix-pagination-for-custom-loops

    Magus

  4. 9 years, 2 months ago George D.

    Thank you Magus.

    I’ve figured out.

    Have a nice day,
    George D.

  5. 9 years, 2 months ago Andrew Misplon
    Hi, I Work Here

    Glad to hear you made progress on this.

    All the best :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More