-
Author
-
August 27, 2013 at 23:06 #1910CenkParticipant
Hi!
Do you know how to add dynamic buddypress profile links to the wp-menu?
I only know how to import the profile page.So I put the following code in the functions.php.
COPY CODE// 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( '/' ) . '">' . __('Profile') . '</a></li>'; $menu = $menu . $profilelink; return $menu; } }
And it works.
I would also like to add the other bp profile links to the wp-menu, but don’t know how.
– Messages page
– Friends pageThank you for your support.
August 28, 2013 at 08:59 #1924SQadminKeymasterHi,
After:COPY CODE$profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '" rel="nofollow">' . __('Profile','buddypress') . '</a></li>';
you can add another menus like this:
COPY CODE$profilelink .= '<li><a href="' . bp_loggedin_user_domain( '/' ) . 'messages" rel="nofollow">' . __('Messages','buddypress') . '</a></li>'; $profilelink .= '<li><a href="' . bp_loggedin_user_domain( '/' ) . 'friends" rel="nofollow">' . __('Friends','buddypress') . '</a></li>';
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionAugust 28, 2013 at 10:27 #1930kswiftParticipantNice, I would use this! Is there any way to move these items into a dropdown with submenu? Each item on their own within my menu will make the menu very long (across two lines)
August 28, 2013 at 17:51 #1944CenkParticipantThanks! I would like to replace the text with an image/icon. I tried it in Css. But it doesn’t work properly.
Example: I traced the messages (menu) link with firebug and adjust it in Css
COPY CODEdiv.kleo-page header div.header-bg div#header div.row div.eight div.contain-to-grid nav.top-bar section ul#menu-new-menu.left li a{ background-position: left; background-repeat: no-repeat; background-image:url(http://…..com/wp-content/uploads/2013/08/messagesicon.svg) }
But then the other dynamic links get the same icon image. I can’t do it separately.
Is there a way to adjust it in the functions.php?COPY CODE$profilelink .= '<li><a href="' . bp_loggedin_user_domain( '/' ) . 'messages" rel="nofollow">' . __('Messages','buddypress') . '</a></li>';
(removing the text “messages” ..and replacing it with an icon image…doesn’t work this way)
COPY CODE$profilelink .= '<li><a href="' . bp_loggedin_user_domain( '/' ) . 'messages" rel="nofollow">' . __('background-image:url(http://......com/wp-content/uploads/2013/08/messagesicon.svg)','buddypress') . '</a></li>';
I really appreciate your support. And is there a way to disable the menu hover?…or making it transparent.
I want to place the two notification pop-up icons ontop of the wp-menu tabs.Thanks!
August 28, 2013 at 21:26 #1951SQadminKeymasterHi kswift,
Here is a sample from an existing dropdown. You can create yours the same way:COPY CODE<li class="has-dropdown" ><a class="main-menu-link" href="#">Buddypress</a> <ul class="dropdown"><li><a href="#" class="parent-link hide-for-large-up">Buddypress</a></li> <li><a class="sub-menu-link" href="http://seventhqueen.com/demo/sweetdatewp/members/">Members</a></li> <li><a class="sub-menu-link" href="http://seventhqueen.com/demo/sweetdatewp/groups/">Groups</a></li> <li><a class="sub-menu-link" href="http://seventhqueen.com/demo/sweetdatewp/activity/">Activity</a></li> </ul> </li>
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionAugust 28, 2013 at 21:31 #1952SQadminKeymasterHi,
You cant do that (3rd pasted code). Your using css as html.
Give your link a specific class and apply the css to it(this way it won’t apply to all links)
CSS:COPY CODEdiv.kleo-page header div.header-bg div#header div.row div.eight div.contain-to-grid nav.top-bar section ul#menu-new-menu.left li a.my-message-class {...}
PHP:
COPY CODE$profilelink .= '<li><a class="my-message-class" href="' . bp_loggedin_user_domain( '/' ) . 'messages" rel="nofollow">' . __('Messages','buddypress') . '</a></li>';
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionAugust 28, 2013 at 23:38 #1959CenkParticipantThanks again. It works! I’m learning a lot:) I managed to disable the menu hover. But now I’m wondering how to put the two notification pop-up buttons on top of the menu button….that means first clickable.. (think in layers)
At the moment they are behind the wp-menu buttons…(background)August 29, 2013 at 00:06 #1962CenkParticipantI’ve just noticed that the menu position is slightly different in Firefox .
Safari and Chrome are the same.August 29, 2013 at 10:36 #1971SQadminKeymasterI don’t think that existing notifications qualify to be displayed in the menu that way.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.