Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] add posts numbers in members directory


  • alpha2
    Participant

    @neoseeyou

    Hello

    Is someone know the code to display number of posts for each user inside the member directory list?

    I am stuck

    Thank you

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

  • Henry Wright
    Moderator

    @henrywright

    Try echo count_user_posts( bp_get_member_user_id() );


    alpha2
    Participant

    @neoseeyou

    I just found this solution my self

    
    <?php
        $user_id = bp_get_member_user_id(); 
        $query = new WP_Query( 'author=' . $user_id );
    
     echo count_user_posts($user_id,'post');
    
    //reset for next member
    wp_reset_postdata();
    ?>

    But yours is really better 😉

    Thank you Henry

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] add posts numbers in members directory’ is closed to new replies.
Skip to toolbar