Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Posts of Displayed User

  • @chinochau

    Participant

    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)
  • @4ella

    Participant

    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)
  • The topic ‘Custom Posts of Displayed User’ is closed to new replies.
Skip to toolbar