-
Author
-
February 16, 2017 at 01:17 #153158HappiierParticipant
Good Day,
I am trying to show all user posts in buddypress profile. You recommend Social Articles but I have two issues:
1. Does not show Custom Post Types (CPT’s)
2. The format doesn’t match Kleo theme well
Is it possible to call user posts/CPT’s for given user profile to show in Kleo Masonry?
I can create a new buddypress tab, I just need to know how what to add from Kleo theme.
Thank you!
Blaze
February 17, 2017 at 06:47 #153266LauraModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! ?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
February 20, 2017 at 18:01 #153541RaduModeratorHi,
You can pull posts from certain CPT’s using Kleo posts and build query function
You can create new BuddyPress profile tab inspiring from here but you need to have some PHP knowledge: http://wordpress.stackexchange.com/questions/46279/im-trying-to-add-a-new-buddypress-menu-tab-and-it-is-not-showing-up
Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionFebruary 21, 2017 at 23:45 #153781HappiierParticipantThank you for your response. I found this code snippet which seems to be great! However, I am having an issue identifying which template part would work to display KLEO MASONRY posts for a given author. (see images)
Can you please identify which .php file I should be calling or what to include in a new.php template.
I have tried many existing as you can see in the images. None were exactly correct.
With Gratitutde,
BlazeCODE:
// Display posts in user profile
// Construct new user profile tab
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’ => 35
)
);
}// show ‘Posts’ tab once 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’ ) );
}// query the loop and get the template
function profile_screen_posts_show() {
$user_id = bp_displayed_user_id();
$query = new WP_Query( ‘author=’ . $user_id );if ( $query->have_posts() ) :
while ( $query->have_posts() ): $query->the_post();
// fill in your template part here, if you have another template than member-posts.php
get_template_part( ‘member-posts’ );
endwhile;else: ?>
// if the author hasn’t made any posts, display this message
<p><?php bp_displayed_user_username(); ?>’s hasn’t made any posts yet! </p><?php endif; wp_reset_postdata();?> <?php
}
Attachments:
You must be logged in to view attached files.February 22, 2017 at 00:03 #153793HappiierParticipantActually, projectwyld.com/author/authorname is exactly what I need to show.
It has the appropriate Kleo Masonry in the correct columns. I just need for the main content area/post area to be called without the sidebar, footer, and socket as when I plug in archive.php in the code provided.
Hope this helps.
February 22, 2017 at 07:50 #153844HappiierParticipantPLEASE SKIP AHEAD TO THIS REPLY!!!!!!!!!!!!!!!!!!!!!!!!
I am super close and now only need simple advice. I used the following code and I am just about able to complete the process (SEE PHOTO). However, I need some help to get things in order.
I am pretty sure that I need to make new template parts, but I need some clarity if this is correct. Thank you so much!!
———————————————————————————-
Note: “bpawesome” = copy of Archive.php that I can modify.
//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( ‘bpawesome’ );
else:?><p><?php bp_displayed_user_username(); ?> has not published any post! </p><?php endif; ?> <?php
}
//POSTS ON PROFILE ENDS HERE
Attachments:
You must be logged in to view attached files.February 22, 2017 at 18:22 #153907RaduModeratorHi the kleo post templates are located in kleo theme directory
Most probably you will have to copy from example the content-audio.php file to child theme and to rename it to content-tabbuddypress.php and inside build your loop template and then form your snippet instead of calling get_template_part( ‘bpawesome’ ); you will have to call get_template_part( ‘content’, ‘tabbuddypress’ ); kind of
Read here how the get template works https://konstantin.blog/2013/get_template_part/
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Plugins questions’ is closed to new topics and replies.