@messina82
Active 9 years, 4 months ago
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Thank you very much all. I’ve been able to add the profile image to users logged in but for some reason it strips all the code around it. The avatar as well as the other links are part of a unordered list. This is the code i’m working with:
// Filter wp_nav_menu() to add profile link in a specific custom menu function member_links($menu, $args) { if( is_user_logged_in() && $args->theme_location == 'membermenu' ){ $profilelink = '<li class="bp-menu bp-activity-nav menu-item menu-item-type-custom menu-item-object-custom"><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('My Profile') . '</a></li>'; $profileimage = '<li class="bp-menu bp-activity-nav menu-item menu-item-type-custom menu-item-object-custom"><a href="' . bp_loggedin_user_domain( '/' ) . '">' . bp_loggedin_user_avatar() . '</a></li>'; $menu = $profilelink . $profileimage . $menu; } else { if( !is_user_logged_in() && $args->theme_location == 'membermenu' ){ $profilelink = '<li class="bp-menu bp-activity-nav menu-item menu-item-type-custom menu-item-object-custom"><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('Test') . '</a></li>'; $menu = $profilelink . $menu; } } return $menu; } add_filter( 'wp_nav_menu_items', 'member_links', 10, 2 ); //Member Menu function buddy_navigation () { echo '<div class="member-menu-container">'; $args = array( 'theme_location' => 'membermenu', 'container' => 'nav', 'container_class' => 'wrap', 'menu_class' => 'menu genesis-nav-menu member-menu', 'depth' => 1, ); wp_nav_menu( $args ); echo '</div>'; } add_theme_support ( 'genesis-menus' , array ( 'primary' => 'Primary Navigation Menu' , 'secondary' => 'Secondary Navigation Menu' ,'membermenu' => 'Member Menu' ) ); add_shortcode('buddynav', 'buddy_navigation');
Essentially i’m creating the buddy navigation, outputting it as a shortcode and throwing it in a widget followed by appending the additional links above.
Any idea what’s going on here? Also if i were to integrate specific admin links, would I add another else / if statement targeted to is_admin?
Thanks for the help!
Viewing 1 replies (of 1 total)