BuddyBoss Home – Web › Support Forums › Themes › Boss. theme › add rtmedia link to titlebar only
- This topic has 5 replies, 2 contibutors, and was last updated 9 years, 1 months ago by Anonymous.
Question
September 23, 2015 at 5:20 pm #46979@surfbuddyHi guys, how do I add rtmedia to the titlebar menu only? The following code from rtmedia support adds it to the titlebar and buddypanel.
function my_wp_get_nav_menu_items( $items, $menu, $args ){ if ( is_user_logged_in() && class_exists( 'RTMedia' ) ) { $user_id = get_current_user_id(); // get current logged in user id $url = trailingslashit ( get_rtmedia_user_link ( get_current_user_id () ) ) . RTMEDIA_MEDIA_SLUG . '/'; // get user's media link // add new menu item to nav menu $new_item = new stdClass; $new_item->menu_item_parent = 0; $new_item->url = $url; $new_item->title = 'My Media'; $new_item->menu_order = count( $items ) + 1; $items[] = $new_item; } return $items; } add_filter( 'wp_get_nav_menu_items', 'my_wp_get_nav_menu_items', 99, 3 );
Answers
September 24, 2015 at 5:01 am #46988@
AnonymousHi @surfied
Title bar is regular wordpress menu, you can request RT media to provide functions to add menu with media count and menu need to be added wp_nav_menu()
function my_wp_get_nav_menu_items( $items, $menu, $args ){ if ( is_user_logged_in() && class_exists( 'RTMedia' ) ) { $user_id = get_current_user_id(); // get current logged in user id $url = trailingslashit ( get_rtmedia_user_link ( get_current_user_id () ) ) . RTMEDIA_MEDIA_SLUG . '/'; // get user's media link // add new menu item to nav menu $new_item = new stdClass; $new_item->menu_item_parent = 0; $new_item->url = $url; $new_item->title = 'My Media'; $new_item->menu_order = count( $items ) + 1; $items[] = $new_item; } return $items; } <nav> <?php wp_nav_menu(array( 'theme_location' => 'my_menu_location', 'items_wrap' => my_wp_get_nav_menu_items() )); ?> </nav>
where my_menu_location is the menu to which you have to incldue the extra item
RegardsSeptember 24, 2015 at 11:56 am #47027@surfbuddyThanks, but that just displayed all of current pages in the titlebar. What is the best way to add a dynamic bp link to the menu? Is it possible to add to the custom links option in menus, but what goes in the URL field for http://sitename.com/members/dynamicusername/media to work ?
September 24, 2015 at 10:43 pm #47043@
AnonymousHi @surfbuddy
You can use https://wordpress.org/plugins/bp-direct-menus/
Regards
VarunSeptember 26, 2015 at 6:00 pm #47204@surfbuddyThanks @vapvarun! This didn’t work before since I have friend connections off. I removed the call for friendcount from the plugin and it works now. However, the counter for other items like messages is not showing the number badge. It shows the count number plainly (e.g Messages7 ), but not the badge. Would you know a fix for this?
September 27, 2015 at 3:19 am #47219@
AnonymousHi @surfbuddy, you can use them as following and these are also explained in their help note
Friends %(friendcount)%
Messages %(unreadmessagecount)%
Regards
- The question ‘add rtmedia link to titlebar only’ is closed to new replies.