Shortcuts for top menu?
Add to your theme’s functions.php file http://pastebin.com/HSpJNLyV
Wonderful, that works perfectly. Just one thing, I’m using the IfMenu, a conditional menu. How can I hide this menu item for users who are logged in only as it does not show up in the menus under Appearance.
Here is a better question. Can this code be added where I can create a menu in the Appearance section of the GUI instead of hacking the php file?
How can I hide this menu item for users who are logged in only as it does not show up in the menus under Appearance.
@voopress The code above shows the link only for logged in users. The link won’t show up if they’re not logged in. Why would you want to “hide this menu item for users who are logged in only”?
instead of hacking the php file
There’s no hacking being done here 🙂 You’re legitimately adding a filter to include the dynamic link to the menu. You can change the markup in the code posted just so those additional class/es would match those of the IfMenu’s. I’m not aware of any menu plugin which allows you to add a dynamic link.
>Why would you want to “hide this menu item for users who are logged in only”?
Simply because it doesn’t apply to non logged in users so might be confusing. I tend to hide menus which guests don’t need to keep things less confusing.
>There’s no hacking being done here
Well, it works perfectly so I guess I just need to keep a note to add this to the theme if it gets updated.
While we’re at this and you seem to know a lot about the menus, is there a list of other variables which can be used in this way?
Also, when a blog owner is in the Dashboard, they can see other blog owners sites/dashboard. Even though they can’t log into them, it’s confusing. I’d like to change that My Sites to one single link back to the main site. Is there a way of doing that?
Sorry, I meant that I do only want to show it to logged in users and for the stated reason.
BTW, is there a way to change menu positions in the code you supplied? It works perfectly but it is in the wrong position in the menu of our particular site.
Something got lost in translation. To reiterate, the code to the dynamic link in the menu will only show up when user is logged in, so we’re on the same page 🙂
It works perfectly but it is in the wrong position in the menu of our particular site.
How is it in the wrong position?
Right, only logged in users see it which is what we want.
Wrong position simply meaning esthetically, it would be better if I could place it in another menu position.
So, let’s say I called the new menu ‘NewMenu’. I have other menu items, say,
MenuItem1 MenuItem2 MenuItem3 NewMenu
I need to have NewMenu in position two for example so that the new menu looks like;
MenuItem1 NewMenu MenuItem2 MenuItem3
- The topic ‘Shortcuts for top menu?’ is closed to new replies.