Create custom infinite pagination

  • estevaoacioli
    Participant
    # 3 months, 1 week ago

    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
    # 3 months, 1 week ago

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

    It works like a charm with WPSOLR.

    estevaoacioli
    Participant
    # 3 months, 1 week ago

    Does it work with posts and pdf?

    wpsolr
    Keymaster
    # 3 months, 1 week ago

    Yes, with any post type your search returns.

    estevaoacioli
    Participant
    # 3 months, 1 week ago

    Thank you

    🙂

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

You must be logged in to reply to this topic.