• Hi everyone, Shortcodes not displaying in BuddyPress Activity Stream. Somebody know how to include shortcodes in activity stream? thnks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor BuddyDev

    (@buddydev)

    Hi,
    Thank you for the question.

    I am assuming this is not related to our plugin and you want to enable the shortcode in activity in general.

    You can put this code in your theme’s functions.php

    
    
    /**
     * Enable shortcode rendering in BuddyPress activity.
     */
    add_filter( 'bp_get_activity_content_body', function ( $content ) {
    	return do_shortcode( $content );
    }, 0 );
    
    

    That will do it.

    Regards
    BuddyDev Team

    Thread Starter Fábio Roque

    (@fabioroque92)

    Hi BuddyDev, thnks for you help I’m trying solve this problem. I had already tried with something similar but doesn’t work, with your code doesn’t work too. look if you try this:

    add_filter( 'bp_get_activity_content_body', function ( $content ) { 
                  error_log( $content );
    }, 0 ); 

    And try include one shortcode in one post and try include ‘ [just_test] ‘ in another post… You will see the log file return empty in first post and return “[just_test]” in second post.

    Maybe have some filter to remove shortcode before the our filter. Sorry for my english but did you understand what i said? thnks again mate

    • This reply was modified 3 years, 4 months ago by Fábio Roque.
    Plugin Contributor BuddyDev

    (@buddydev)

    Hi,
    I am sorry, I don’t know what your code for error_log is supposed to do.

    The code I shared for shortcode is tested with BuddyPress 9.0 and BP Nouveau template pack. If it is not working, you most probably have some code/theme or other template pack causing it.

    Regards
    BuddyDev Team

    Thread Starter Fábio Roque

    (@fabioroque92)

    Hi really thank you for your help, I already understand why doesn’t work to me, because me shortcode is [contact-form-7 id=”xx”] if I use a shortcode without “” it Works, do you know how to fix this “” problem ? thnks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘shortcodes in activity stream’ is closed to new replies.