Hi, first off all, hanks for sharing @azchipka‘s code, i have been looking for that function myself.
I found a way to adjust the code to what you need
function profile_screen_posts_show() {
query_posts( 'author=' . bp_displayed_user_id() );
if ( have_posts() ) : ?>
<div class="category-wrap" style="width:100%;">
<ul class="two-post-wrap">
<?php // Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/ ?>
<li>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_post_thumbnail(); ?>
<?php the_excerpt();?></span>
</li>
<?php // End the loop.
endwhile; ?></ul></div>
<?php else:?>
<div id="message" class="info">
<p><?php bp_displayed_user_username(); ?> has not published any post! </p>
</div>
<?php endif; ?> <?php
}
//POSTS ON PROFILE ENDS HERE
?>
You can remove thumbs, excerpt if you like, and/or add css classes.
I used this code here on my site
Changed posts to articles and working like a charm
Thanks again
Oops, just realized that there is a second list of posts after the first, weird and I do not know yet how to fix it.
@peter-hamilton, thank you so much, i got closer to what i needed with your code. And like you i dont know how to remove second list either.
Is there anyone to help on this issue?
Regards,
Ozan
I have skipped that code for now since I do not know how to solve that specific double list problem.
Until then I have added a profile nav link to the archive page for viewed author which also works, but I would prefer to see posts on the actual profile.
I will try to integrate somehow a part of the archive into the buddypress members plugin.php later tonight.
Hi, can anyone knows this issue?
I want to:
– give hyperlink to page titles.
– post content must be deleted.
– get the thumbnail to page.
`//POSTS ON PROFILE STARTS HERE
add_action( ‘bp_setup_nav’, ‘add_profileposts_tab’, 100 );
function add_profileposts_tab() {
global $bp;
bp_core_new_nav_item( array(
‘name’ => ‘My Posts’,
‘slug’ => ‘posts’,
‘screen_function’ => ‘bp_postsonprofile’,
‘default_subnav_slug’ => ‘My Posts’,
‘position’ => 25
)
);
}
// show feedback when ‘Posts’ tab is clicked
function bp_postsonprofile() {
add_action( ‘bp_template_content’, ‘profile_screen_posts_show’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
}
function profile_screen_posts_show() {
query_posts( ‘author=’ . bp_displayed_user_id() );
if ( have_posts() ) :
get_template_part( ‘author’ );
else:?>
<div id=”message” class=”info”>
<p><?php bp_displayed_user_username(); ?> has not published any post! </p>
</div>
<?php endif; ?> <?php
}
//POSTS ON PROFILE ENDS HERE
Did anyone manage to solve the double post problem?
@peter-hamilton?
Also, can we get pagination in this?
Hi, i am new with buddypress and i like to have the posts from the users on the profil page too. But i have the same double entries. This looks bad. Is there any news to fix this?
I am trying to do this as well. Has this ever been resolved?