Is it possible to display each users blog post count on a custom page?
For example, I use the following code to display a users total friend count on their profile page.
<a href="<?php echo bp_displayed_user_link().'friends/'; ?>"> <?php echo BP_Friends_Friendship::total_friend_count(bp_displayed_user_id()); ?> Friends</a>
Is there a php code to display a users total number of blog posts?
Thx
Hi John,
You can usecount_user_posts( $user_id, $post_type )
to get the count of user posts.
Please see this for example.
https://codex.wordpress.org/Function_Reference/count_user_posts
Regards
BrajeshThank you for leading me in the right direction. The following code worked for me.
<?php echo count_user_posts( $user_id = bp_displayed_user_id(), $post_type = 'post' ) ?>
When I arrive on a users profile, it now shows me how blog posts the users has created. Below is the code is its entirely.
<a href="<?php echo bp_displayed_user_link().'buddyblog/'; ?>"> <?php echo count_user_posts( $user_id = bp_displayed_user_id(), $post_type = 'post' ) ?> Blog</a>
This issue is resolved.
Thx!!
Hi John,
Thank you for sharing.I am glad it is resolved
Regards
Brajesh
The topic ‘ [Resolved] BuddyBlog – Display Blog Count – Custom Page’ is closed to new replies.