BuddyDev

Search

[Resolved] Buddyblog: Hide certain Categories and Tags

  • Participant
    Level: Initiated
    Posts: 17
    Present Phuture on #12235

    Hello BuddyDev Team

    Thank you for creating an amazing plugin. I would like to know if it’s possible to hide certain category and tag ID’s via php on my bp-custom.php file. I would like some categories to be for verified members that the admin selects (example: the medical category & tag for health practitioners only). I would like to hide which tags, categories are shown frontend to users.

    Thank You.

    Regards

    PresPhuture

  • Keymaster
    (BuddyDev Team)
    Posts: 24338
    Brajesh Singh on #12255

    Hi PresPhuture,
    Thank you for posting.
    Yes, it is possible to control which category/tags are shown

    
    
    /**
     * Filter the BuddyBlog form settings and limit category/tag inclusion.
     *
     * @param array $settings settings array.
     *
     * @return array
     */
    function buddydev_filter_buddyblog_form_settings( $settings ) {
    
    	$tax                        = isset( $settings['tax'] ) ? $settings['tax'] : array();
    	$tax['category']['include'] = array( 1, 2, 3 );// category ids to include.
    	$tax['post_tag']['include'] = array( 5, 7, 9 );// tag ids to include.
    
    	$settings['tax'] = $tax;
    
    	return $settings;
    }
    
    add_filter( 'buddyblog_post_form_settings', 'buddydev_filter_buddyblog_form_settings' );
    
    

    Please change the ids with your own. It will only list the category tags with those ids. I hope you can modify it form there on.

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 17
    Present Phuture on #12304

    Hi Brajesh

    Unfortunately the code didn’t work. When I go to the frontend, all of the categories and post tags are there, not those I specifically chosen for the frontend or buddyblog.

  • Keymaster
    (BuddyDev Team)
    Posts: 24338
    Brajesh Singh on #12325

    Hi PresPhuture,
    I will check it on a demo and let you know today. I am not sure what is wrong with the above code.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 17
    Present Phuture on #12366

    No Probem

    Thank you for the assistance.

  • Participant
    Level: Initiated
    Posts: 17
    Present Phuture on #12575

    Hi Brajesh

    Hope you had a great Christmas and Boxing day. I would like to know if there is any update regarding the demo.

    Regards

    PresPhuture

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3047
    Ravi on #12577

    Hi PresPhuture,

    I have tested the code on my local server and it is working fine. Are you dealing with normal WordPress post categories or other custom taxonomy categories?. Please let me know.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 17
    Present Phuture on #12578

    Hi Ravi

    I’m using the normal WordPress post categories and taxinomies.

    Regards
    PresPhuture

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3047
    Ravi on #12580

    Hello PresPhuture,

    Thank you for the acknowledgement. Can you please provide me with the screenshot of the BuddyBlog settings screen. Also if you are modifying BuddyBlog settings programmatically post me the code too.

    Thank You
    Ravi

  • Participant
    Level: Initiated
    Posts: 17
    Present Phuture on #12596

    Hi Ravi

    How do I send a screenshot on buddydev as there isn’t an upload image menu.

    Regards

    PresPhuture

The topic ‘ [Resolved] Buddyblog: Hide certain Categories and Tags’ is closed to new replies.

This topic is: resolved