Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add item to main activity Subnav

  • @okuleyeflo

    Participant

    Hi,

    Please can someone help out with a code to add extra item to the main activity Subnav .

    Where it says: All Members My Friends My Favorites Mentions [New Item]

    Am using latest WP/BP

    thanks in advance.

    Regards

    FLO

Viewing 10 replies - 1 through 10 (of 10 total)
  • @danbp

    Participant

    hi @okuleyeflo,

    the code below puts a tab on the user activity page.
    Try it from within your theme’s functions.php file

    function my_setup_nav() {
    	global $bp;
    	
    	bp_core_new_nav_item( array( 
    	'name' => __( 'Item One', 'buddypress' ), 
    	'slug' => 'my-item-one', 
    	'position' => 70 
    	) );
    	
    }
    add_action( 'bp_setup_nav', 'my_setup_nav' );

    Some more details
    A little spoon of Codex ?

    @okuleyeflo

    Participant

    @danbp,

    Thanks so much for your effort, the code you gave above add item to Just-Me activity and not the main activity.

    Thanks for your input anyways

    Flo

    @okuleyeflo

    Participant

    Polite Bump

    @shanebp

    Moderator

    Take a look at:
    \buddypress\bp-templates\bp-legacy\buddypress\activity\index.php

    You’ll see the link markup there.
    So you can over-ride that template and add some markup.

    Or you can leave it alone and use one of the many hooks, such as:
    do_action( 'bp_activity_type_tabs' );
    To insert your link via a function.

    @okuleyeflo

    Participant

    @shanebp,

    thanks so much for your help, although am new to all this code stuffs but after reading through codex have came up with the below code but it is not working.

    Any help will be highly appreciated.

    function bp_myadd_tabto_mainactivity() {         
    global $bp;
    
    '<li id="activity-invito"><a href="/invite-friends">Invite your friends</a></li>';}
    
    do_action( 'bp_activity_type_tabs','bp_myadd_tabto_mainactivity ');

    thanks

    @shanebp

    Moderator

    try this:

    function bp_myadd_tabto_mainactivity() {         
     echo '<li id="activity-invito"><a href="/invite-friends">Invite your friends</a></li>';
    }
    add_action( 'bp_activity_type_tabs','bp_myadd_tabto_mainactivity');

    @okuleyeflo

    Participant

    @shanebp,

    thanks so muck for your great help, the link now shows on the activity page tab but when click, it just stay the same and not going to the link page.

    Any suggestion? so sorry to disturb you just a newbie.

    regards

    @shanebp

    Moderator

    Does the correct link exist somewhere else?

    If so, paste it here.

    @okuleyeflo

    Participant

    @shanebp,

    thanks so much, the link is correct and it a normal page create from wp admin.

    and I just want to use the code to just link to that page called invite-friends

    so I used the code you help me with to link it

    function bp_myadd_tabto_mainactivity() {         
     echo '<li id="activity-invito"><a href="/invite-friends">Invite your friends</a></li>';
    }
    add_action( 'bp_activity_type_tabs','bp_myadd_tabto_mainactivity');

    @okuleyeflo

    Participant

    @shanebp,

    You are the man, thanks for your help. changing ID to class solved the problem.

    Thumbs Up and thanks for your time.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to add item to main activity Subnav’ is closed to new replies.
Skip to toolbar