BuddyDev

Search

[Resolved] Display Group Description in sidebar

  • Participant
    Level: Enlightened
    Posts: 88
    Torben Heikel Vinther on #19103

    Hi

    How do I manage to display the Group Description in the side and/or in the group header?
    I can’t find a suitable shortcode anywhere, so please help me, thanks 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #19108

    Hi Torben,
    Here is a shortcode I created for you

    
    
    /**
     * Group description shortcode.
     *
     * @param array  $atts attributes.
     * @param string $content content.
     *
     * @return string
     */
    function buddydev_custom_group_description_shortcode( $atts = array(), $content = '' ) {
    
    	$atts = shortcode_atts( array(
    		'group_id' => bp_get_current_group_id(),
    	), $atts );
    
    	return $atts['group_id'] ? bp_get_group_description( groups_get_group( $atts['group_id'] ) ) : '';
    }
    
    add_shortcode( 'bpcustom-group-description', 'buddydev_custom_group_description_shortcode' );
    
    

    You can keep the code in bp-custom.php or child theme’s functions.php

    and use it like

    
    [bpcustom-group-description]
    
    

    To show it for current group.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 88
    Torben Heikel Vinther on #19109

    Awesome. Thank you VERY MUCH Brajesh 🙂

The topic ‘ [Resolved] Display Group Description in sidebar’ is closed to new replies.

This topic is: resolved