Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show loop of posts from member on profile.


  • 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)

  • enderpal444
    Participant

    @enderpal444

    bump


    enderpal444
    Participant

    @enderpal444

    standard 2nd bump


    Paul Wong-Gibbs
    Keymaster

    @djpaul


    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?


    Paul Wong-Gibbs
    Keymaster

    @djpaul

    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)?


    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.


    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)
  • The topic ‘Show loop of posts from member on profile.’ is closed to new replies.
Skip to toolbar