I want to add or remove some menu items from my site in wordpress.
For example depending on some property I want to add menu item or remove menu item dynamically.
if(isset($userName)) {
//print a menu item with the text as "Hello ".$userName;
//print a menu item logout
//hide login menu item
}
else {
//hide logout
//show login menu item
}
I wonder how it can be done, as menu in wordpress is static? Any one can help?
You can try the Menu Item Visibility Control plugin. It shows the menu item only when a custom condition is met.
you may use if-menu plugin, i think it meets your need
Hope this answer may help you