• Resolved jeanmorency

    (@jeanmorency)


    I am trying to change Older/Newer posts at the bottom of search result for more advanced paging navigation.
    I would like to use the following plugin
    WP-PageNavi
    https://www.ads-software.com/plugins/wp-pagenavi/installation/
    It requires us to change the code below.
    I am trying to understand how I may do this with SoSimple?
    If you have a better alternative, your suggestion is welcome.
    Thank you for taking the time to reply.
    *-*-*-*-*
    Usage

    In your theme, you need to find calls to next_posts_link() and previous_posts_link() and replace them.

    In the Twentyten theme, it looks like this:

    <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>

    <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>

    You would replace those two lines with this:

    <?php wp_pagenavi(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author fervillz

    (@fervillz)

    Hello, my apology. I didn’t get notification on this one. Is your problem already solve?

    Hi,

    I have used the function on the following link
    https://www.wpbeginner.com/wp-themes/how-to-add-numeric-pagination-in-your-wordpress-theme/

    and the following code is from my search page just to give an idea that how to use this function and how the query should be.

    
    
    global $wpdb;
    $per_page = 10;
    $page = get_query_var( 'paged' );
    
    $page = ($page == 0 ? 1 : $page);
    $start = ($page - 1) * $per_page;
    $page_offset = $per_page;
    
    $results = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_date, $wpdb->posts.post_date_gmt,$wpdb->posts.post_excerpt, $wpdb->posts.post_content, $wpdb->posts.post_type
           FROM $wpdb->posts Where
           $wpdb->posts.post_status = 'publish'
           AND $wpdb->posts.post_type = 'post'
           AND ($wpdb->posts.post_title LIKE '%".$search_keyword."%' OR $wpdb->posts.post_excerpt LIKE '%".$search_keyword."%' OR $wpdb->posts.post_content LIKE '%".$search_keyword."%')
                                    ORDER BY $wpdb->posts.post_date_gmt DESC Limit $start, $page_offset");
    
    and then after looping through the data at the end call this function
    <div id="pagination_div"><?php wpbeginner_numeric_posts_nav(); ?></div>
    
    
    

    Try it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Changing Older/Newer posts for more advanced paging navigation’ is closed to new replies.