Add a user-specific item to the main menu

  • Anonymous

    #209

    I would like to do this for logged-in users …

    * If the user level is Contributor or higher, add a new item named ‘Your posts’ to the main menu.

    * If the user has at least one post, the menu item will link to the user’s Author page.

    * If the user has zero posts, the menu item will link to a help page encouraging the user to get started, explain how to do it, with a further link to /wp-admin/edit.php

    Testing for user level and post count is not a problem — that could be done in the header — but I can’t figure out how to add a new item to the Graphene main menu.

    Can anybody point me in the right direction?

    Thanks 🙂

    Admin

    Syahir Hakim

    #11636

    You can use the WordPress’ Custom Menu feature (accessible via Appearance > Menus) to add new menu items, but it doesn’t support checking for conditionals. For this reason, it’s probably easier to code the menu item yourself and add it to the navigation bar by using the graphene_top_menu action hook.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Do NOT follow this link or you will be banned from the site!