• Resolved PaulBart1974

    (@paulbart1974)


    Hi. Plugin works great, but it seems to repeat posts if you are on a recent post the plugin will load a repeat of that post. Is there away to add a “post_not_in” query so that you don’t get repeats? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @paulbart1974,
    Thanks!

    I have a code sample set up for this.
    https://connekthq.com/plugins/ajax-load-more/docs/code-samples/exclude-posts/

    Hope that helps!

    Thread Starter PaulBart1974

    (@paulbart1974)

    Thanks for getting back to me! I can’t seem to get this to work. I currently have this in my repeater – as I want to pull in the entire post.

    <div class=”col-12 post-repeater”>
    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>
    </div>

    and have placed this short code into my single.php template

    <?php echo do_shortcode( ‘ [ajax_load_more id=”2876571844″ container_type=”div” post_type=”post” posts_per_page=”1″ category=”booze,culture,eats,faces,whats-happening”] ‘); ?>

    So in order to add the post__not_in where do I add the code sample? As even if I add all of the sample code to the template it doesn’t work, I still get duplicates of the original post the load more follows.

    • This reply was modified 6 years, 9 months ago by PaulBart1974.
    • This reply was modified 6 years, 9 months ago by PaulBart1974.
    Plugin Author Darren Cooney

    (@dcooney)

    All you need to pass the post IDs you want to exclude from your Ajax Load More query to the post__not_in shortcode parameter.

    global $post;
    $id = $post->ID;
    echo do_shortcode('[ajax_load_more post__not_in="'. $id .'"]');

    Hope that helps.

    • This reply was modified 6 years, 9 months ago by Darren Cooney.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post not in’ is closed to new replies.