Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 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

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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