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!
If you use
wp_nav_menu()
to display your menu, you can add items to it by filteringwp_nav_menu_items
,wp_nav_menu_{$menu_slug}_items
, orwp_nav_menu