Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Posts of Displayed User

  • Avatar of ChinoChau
    ChinoChau
    Participant

    @chinochau

    Hi, Ive been Google’ng for hours on this one. Found some useful suggestions on this forum but can’t get it to work. I got a custom post type called ‘klusjes’, I want to display all of the ‘klusjes’ by the displayed user.

    So if you are on the profile of Laura, you would see all her custom posts (klusjes). So far, I got this (which displays ALL custom posts, not of the specific displayed user)

    http://pastebin.com/ERWq8eE7

    Any help is welcome!

Viewing 1 replies (of 1 total)
  • Avatar of 4ella
    4ella
    Participant

    @4ella

    This should work (added: ‘author’ => bp_displayed_user_id(), )

    `<?php
    if ( is_user_logged_in() ):

    query_posts(array(
    ‘post_type’ => ‘klusjes’,
    ‘author’ => bp_displayed_user_id(),
    ‘showposts’ => 3
    ) );
    ?>
    <?php while (have_posts()) : the_post(); ?>
    <h3><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></h3>
    <p><?php echo limit_words(get_the_excerpt(), ’20′); ?></p>
    <?php endwhile;

    else :

    echo “Je hebt nog geen klusjes geplaatst”;

    endif;
    ?>`

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.