How to hide some menu and add some menu dynamically

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?

Related posts

Leave a Reply

2 comments