Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show loop of posts from member on profile.

  • Avatar of enderpal444
    enderpal444
    Participant

    @enderpal444

    I’m trying to show a loop of all posts by an author on their profile page. I’m using infinite scroll to display them but for some odd reason it only shows the initial post_per_page limit and won’t trigger any posts after that saying that “no more posts available”. I’m only having this problem on a profile page as it works on all index, archive, and search pages. Here’s the loop I’m using. Any ideas?

    `<?php
    global $bp;
    $user_id = $bp->displayed_user->id;
    query_posts($query_string .’&posts_per_page=6′ . ‘&cat=-1′ . ‘&author=’. $user_id);
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <


    content


    >

    `

Viewing 7 replies - 1 through 7 (of 7 total)
  • Avatar of enderpal444
    enderpal444
    Participant

    @enderpal444

    bump

    Avatar of enderpal444
    enderpal444
    Participant

    @enderpal444

    standard 2nd bump

    Avatar of enderpal444
    enderpal444
    Participant

    @enderpal444

    @djpaul Ok I rewrote it like this but it’s still not triggering after the post_per_page limit.

    `<?php
    global $bp;
    $user_id = $bp->displayed_user->id;
    $my_query = new WP_Query(‘&posts_per_page=8′ . ‘&cat=-1′ . ‘&author=’. $user_id);
    if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?>`

    What do you recommend?

    Have you checked basic things, like is $bp->displayed_user->id set, does the user have posts published? Does the code work if you copy it into a regular WordPress template somewhere (obv. manually set $user_id)?

    Avatar of enderpal444
    enderpal444
    Participant

    @enderpal444

    @djpaul The loop shows the correct posts for the corresponding author on their profile. I have loop-index.php and loop-member.php and the templates are the same except the beginning of the loop. So I tested the loop-member.php on the homepage adding a specific author id and it triggers the infinite scroll but loads the same 8 posts each time.

    Avatar of enderpal444
    enderpal444
    Participant

    @enderpal444

    @djpaul I don’t get it. If I set posts_per_page to -1 it shows all the posts correctly. So why isn’t it allowing to page when I set it to 8? How would you do this if it were you?

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.