1

I run a membership site and I want to add a tab to the navigation menu that says, "My Subscriptions" and then add certain pages to that tab, which will be specific for each member depending whether or not they have access to the content.

Right now I just have 20 different menus and 20 different if statements in the PHP file and it is not very efficient, not to mention the amount of menus I have to create tenfold if I want to add more content.

Basically, I need some piece of code in the menu PHP file that says :

if member_is_logged_in('1') {
    add content 1 to "My Subscriptions
} elseif member_is_logged_in('2') {
    add content 2 to "My Subscriptions

Can anyone help me out with this? Thanks!

1

If you use wp_nav_menu() to display your menu, you can add items to it by filtering wp_nav_menu_items, wp_nav_menu_{$menu_slug}_items, or wp_nav_menu

  • That sounds like exactly what I need, but I'm not sure how I would use them to add menu items? – Stephen Sep 11 '12 at 4:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.