Skip to:
Content
Pages
Categories
Search
Top
Bottom

Help with Buddypress URLs


  • AkumaSeijin
    Participant

    @akumaseijin

    So, I decided I want to make a custom floating menu on my site and put most of the buddypress functions there to get rid of the clutter on the page itself but I am having a bit of a problem.

    Example: http://example.com/members/exampleuser/

    The menu plugin i’m using grabs from the appearance/menu screen. So, If I am going to add items by url how would I replicate this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You could replicate the styles in the plugin and then manually create a menu via your theme. Would that suit your needs?

    This link offers an alternate solution: http://wordpress.stackexchange.com/questions/35163/add-buddypress-profile-and-messages-link-to-wordpress-menu

    You might also look into custom walkers for the WordPress menu.


    AkumaSeijin
    Participant

    @akumaseijin

    I actually grabbed this code from another support post:

        // Filter wp_nav_menu() to add profile link
        add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
        function my_nav_menu_profile_link($menu) {      
                if (!is_user_logged_in())
                        return $menu;
                else
                        $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '" rel="nofollow">' . __('Visit your Awesome Profile') . '</a></li>';
                        $menu = $menu . $profilelink;
                        return $menu;
        }
    

    But it adds it to both of my menus I only want it on a secondary one. It’s a floating menu. On the menu page it is labeled ” CodeFlavors floating menu ” and the menu itself I call “Floating” don’t know if that wil help with the code alteration. Also, one more thing. Is there a way to add it to the top of the menu instead of the bottom?


    @mercime
    Keymaster

    @mercime

    @akumaseijin you have to find the theme_location of your secondary custom menu. For example, in the Twenty Ten theme, the theme_location is ‘primary’ see https://codex.wordpress.org/Function_Reference/wp_nav_menu#Used_in_the_Twenty_Ten_theme

    After you find the theme_location of your secondary menu, replace mamamia in what I posted at http://pastebin.com/jFLsdDJG


    AkumaSeijin
    Participant

    @akumaseijin

    I did “Inspect Element” on the Menu page to see if I could get the code and I thought I did “cfm_floating_menu” but it still didn’t work. Is there another identifier I can try?


    @mercime
    Keymaster

    @mercime

    You need to look for the theme_location within the template file, not in the source code (inspect element).


    AkumaSeijin
    Participant

    @akumaseijin

    I found it. “CFM_LOCATION” but it still isn’t working.


    AkumaSeijin
    Participant

    @akumaseijin

    So far this is the only code I found that works but it puts it in both menus. I tested your code with “primary” and nothing happened.

        // Filter wp_nav_menu() to add profile link
        add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
        function my_nav_menu_profile_link($menu) {      
                if (!is_user_logged_in())
                        return $menu;
                else
                        $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '" rel="nofollow">' . __('Visit your Awesome Profile') . '</a></li>';
                        $menu = $menu . $profilelink;
                        return $menu;
        }
    
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Help with Buddypress URLs’ is closed to new replies.
Skip to toolbar