BuddyBoss Home – Web Support Forums Themes Boss. theme add rtmedia link to titlebar only

Viewing 6 posts - 1 through 6 (of 6 total)
  • Question

    #46979
    @surfbuddy

    Hi 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

    #46988
    @vapvarun

    Hi @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
    Regards

    #47027
    @surfbuddy

    Thanks, 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 ?

    #47043
    @vapvarun
    #47204
    @surfbuddy

    Thanks @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?

    #47219
    @vapvarun

    Hi @surfbuddy, you can use them as following and these are also explained in their help note
    Friends %(friendcount)%
    Messages %(unreadmessagecount)%
    Regards

Viewing 6 posts - 1 through 6 (of 6 total)
  • The question ‘add rtmedia link to titlebar only’ is closed to new replies.