BuddyDev

Search

[Resolved] BP Profile Tab Pro – Default Tab Error

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14701

    Hi Brajesh,

    I had tried creating a custom post type and entered the shortcode above but to no avail. Is there something I need to tweak with the code you provided earlier for the custom-post-type to work?

    Looking forward to hearing back from you!

    Sujee

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #14702

    Hi Sujee,
    What is the post type name?

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14705

    Well I just deleted it and reverted back to original, but the name was called ‘College Homes’. Actually there were two columns ‘Post Type’ and ‘Name’ – I’m using a third party plugin to achieve this. The Post Type is called ‘college_home_pages’ and the Name is ‘College Homes’. The wordpress dashboard has it called ‘College Homes’. I tried both terms individually and substituted into the ‘custom-post-type-name’ field of the shortcode provide but neither worked. I did create individual posts for each counselor, changed it to private and added appropriate ‘author’ name as well.

    Am I missing something?

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14713

    Hi Brajesh!

    I hope you are enjoying a great weekend! Any updates for me on this? I need custom post type shortcode to work and I think the code needs to be tweaked a little.

    Thank you,

    Sujee

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #14714

    Hi Sujee,
    Thank you.

    I am using the following code to register a post type

    
    /**
     * Register post type for User Content.
     */
    function buddydev_register_post_type() {
    	register_post_type( 'bp_user_content', array(
    		'label'    => 'User Content',
    		'labels'   => array( 'name' => 'User Contents' ),
    		'public'   => false,
    		'show_ui'  => true,
    		'supports' => array( 'title', 'editor', 'author', 'custom-fields' )
    	) );
    }
    
    add_action( 'init', 'buddydev_register_post_type' );
    
    

    and the following shortcode

    
    [bp-user-last-post post_type='bp_user_content']
    

    And it is working.
    I am not sure of the issue but I am guessing your issue may have to do with the post type registration.

    Please give it a shot and let me know if this works for you or not?

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14719

    Sorry Brajesh I don’t understand – do I add that code there to the bp-custom or the snippet you provided earlier?

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #14720

    The code snippet is for registering a new post type. You can put it in bp-custom.php

    Also, please make sure to use the updated shortcode in the profile tabs content.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14721

    Hooraayy! It worked. You are awesome! Now, I’m thinking – if I ever wanted to add something similar, all I need to do is duplicate the code and change the name and corresponding shortcode? If so, this will be VERY useful in case I decide to add more subnavs with similar behavior

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #14722

    Hi Sujee,
    Thank you.

    Yes, you are right about that. All you have to do is register a new post type and use that in the shortcode.

    Best regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 90
    Sujee Kulendran on #14723

    Brajesh – sorry to bother you but I tried registering a new post type and it broke my site. I changed the name of the labels, the bp_user_content name as well. Do I need to do something to the add_action as well?

The topic ‘ [Resolved] BP Profile Tab Pro – Default Tab Error’ is closed to new replies.

This topic is: resolved