• Resolved Fede84

    (@fede84)


    Hi, i’ve got an issue, infinte scroll works but, it duplicate post. Now i’ve got 20 elements in the loop in total, if i set posts_per_page to 8 infinite scroll load first 8 element but the next 8 are the first 8 again and again until get the last page of pagination (in this case 3 page). It seams that if the last page haven’t 8 elements scroll dont’ work. If i set posts_per_page to 10 scroll works perfectly.
    Thx

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi

    Any updates on this? Having the same issue.

    Thanks!

    Plugin Author YITHEMES

    (@yithemes)

    Hi,
    and thank you for contacting us!

    This issue could depend on how you create the custom WP_Query to show your contents: in this case you should set the correct args for pagination.
    We’ve just tried in our local installation by creating a simple code snippet to print the WordPress loop for a custom post type through WP_Query and it works fine with YITH Infinite Scrolling.

    Please try to set the paged attribute in WP_Query args to max(1, get_query_var('page'))
    Example:

    $args = array(
    	'post_type'      => 'your_post_type',
    	'posts_per_page' => 8,
    	'paged'          => max( 1, get_query_var( 'page' ) ),
    );
    
    $query = new WP_Query( $args );

    Please try that solution and let us know if everything works fine!

    not working for me. anyone else?

    Thread Starter Fede84

    (@fede84)

    Worked! I’ve found that the problem was on pagination code. I’ve changed it and add ‘paged’ => max( 1, get_query_var( ‘page’ ) ), and it works!
    Thx a lot!

    Plugin Author YITHEMES

    (@yithemes)

    Hi @fede84 ,
    you’re welcome!
    We would be happy to receive your positive feedback on our product if you’re satisfied ??
    Click here to leave your review. Thank you.

    Plugin Author YITHEMES

    (@yithemes)

    Hi @kokoruz ,
    can you describe your issue?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Duplicate post on custom WP_query’ is closed to new replies.