WordPress.org

Ready to get started?Download WordPress

Forums

Infinite Scroll - Refresh Post List when Infinite Scroll loaded more posts (1 post)

  1. dreiacht
    Member
    Posted 1 year ago #

    Hello everyone,

    I have a problem with my Infinite Scroll plugin.

    On my front page I have a list of all post titles from my front page, they work as a navigation, means, you click on the title and the page automatically scrolls down to the article. Here is the code that does this:

    <?php $result = "<ul class='quicknav-postlist'>";
                $homeposts = get_posts("order=asc&numberposts=".$NUMBEROFPOSTS);
                foreach($homeposts as $post):
                    $result .= "<li><a class='scroll' href='#post-";
                    $result .=get_the_ID($post->ID)."'>".$post->post_title."</a></li>";
                endforeach;
                $result .= "</ul>";
                echo $result; ?>

    The problem is, when I scroll to the bottom of the page, additional 10 posts are loaded by my infinite scroll plugin and my post list of course does not add those new links / titles to the list.

    What I would like to accomplish is, that the list recognizes, when infinite scroll adds new posts and adds those new posts to the list, something like:

    if (Infinite Scroll loaded new articles)
    then (refresh post list)

    I hope someone can help!

    Thanks in advance!

Topic Closed

This topic has been closed to new replies.

About this Topic