Create custom infinite pagination

Tagged:
  • estevaoacioli
    Participant
    5 years ago #11453

    I understand that you have modified the default WP query, how can I access it and create my own pagination?

    Thank you

    
    //Infinite Scroll Search.php
    function wp_infinitepaginate_search(){ 
     $paged = $_POST['page_no'];
     $offset = $paged *10-10;
     
     global $wp_query;    
        $args = array(
            'offset' => $offset,
            'posts_per_page' => 10
        );
        //$wp_query = new WP_Query( $args );
    	$objeto = new WP_Query($args);
    	$posts = $objeto->posts;
    	
    	foreach($posts as $post) {	
    
        echo '<h2 class="feed-card-post-title">'.get_the_title($post).'</h2>';
    	
    	}
    	wp_reset_postdata();
        exit;
    	
    }
    wpsolr
    Keymaster
    5 years ago #11454

    I installed https://fr.wordpress.org/plugins/yith-infinite-scrolling/

    It works like a charm with WPSOLR.

    estevaoacioli
    Participant
    5 years ago #11455

    Does it work with posts and pdf?

    wpsolr
    Keymaster
    5 years ago #11456

    Yes, with any post type your search returns.

    estevaoacioli
    Participant
    5 years ago #11457

    Thank you

    🙂

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

You must be logged in to reply to this topic.