BuddyDev

Search

[Resolved] Custom Text above post form on activity page

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39562

    Which code do I have to modify in order to have a custom text above the post field of the activity page? Pls. see screenshot for clarification => https://i.postimg.cc/Ss5Q8gj9/buddypress-activity.jpg
    thank you for your help!

  • Keymaster
    (BuddyDev Team)
    Posts: 19309
    Brajesh Singh on #39568

    Thank you for the question. There are multiple ways to do it. You can either use the action hook or do a template override.

    Based on your template pack( I am assuming Nouveau), you can copy the post-form.php from wp-content/plugins/buddypress/bp-templates/bp-nouveau/buddypress/activity directory to your theme/buddypress/activity/post-form.php and add the text as needed.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39572

    Hi brajesh. Thank you very much for your answer. How does the action hook work. Can you pls give me an example
    By the way I use the legacy theme

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39596

    Hi Brajesh,
    I tried this shortcode in my functions.php (in Child Theme folder) but somehow I cannot get show up my inserted shortcode above the activity stream. What am I doing wrong?`

    // Add shortcode at the top of the page if page is activity
    add_action(‘kleo_before_main_content’, ‘add_myshort_activity_page_sqk’);
    function add_myshort_activity_page_sqk()
    {
    if (is_page(‘activity’)) {
    echo do_shortcode(‘[buddypressglobalsearch]<br>’);
    }
    }

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 1796
    Ravi on #39609

    Hello Toury,

    Try the following code and let me know if it helps or not.

    
    
    add_action( 'bp_before_directory_activity_content', function () {
    	echo do_shortcode( '[buddypressglobalsearch]' );
    } );
    
    

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 15
    Toury on #39612

    Hi @ravi !
    works like a charm!
    thank you so much!
    you can close this topic!

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 1796
    Ravi on #39613

    Hello Toury,

    Thank you for the acknowledgment. I am glad that I could help.

    Regards
    Ravi

The topic ‘ [Resolved] Custom Text above post form on activity page’ is closed to new replies.

This topic is: resolved