Support » Plugin: WordPress Infinite Scroll - Ajax Load More » Exclude Current post in loop

  • Resolved raven747

    (@raven747)


    Hello,

    Thanks for all the help with setup. Working well now. The issue I am now having is I am trying to ensure the current story is not included in the more articles loop. Just looks cleaner if it excludes it.

    Thanks in advance for all help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author dcooney

    (@dcooney)

    Hi @raven747,
    No problem.

    You can do this by passing the current post ID to post__not_in param.

    // Outside loop
    global $post;
    $exclude  = $post->ID;
    
    echo do_shortcode('[ajax_load_more post__not_in="'.$exclude.'"]');
    Thread Starter raven747

    (@raven747)

    Wow thanks! Is it possible to do this not in direct PHP and just with shortcode, or does this need to be done as a PHP

    Plugin Author dcooney

    (@dcooney)

    No problem!
    Unfortunately it must be done in php.

    Thread Starter raven747

    (@raven747)

    Thanks for the help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude Current post in loop’ is closed to new replies.