How to create one menu that changes dynamically in the PHP file (3 posts)

  1. sjroda
    Posted 3 years ago #

    I have a membership site and would like to create a menu that will change for each member, specifically what content they have access to.

    For example, on the menu there are 5 or so tabs that will remain the same for all users, but there is a "My Subscriptions" tab that I would like to have show the content that the member has access to.

    My current solution is to create 20 different menus and 20 different if statements in the bottom-menu.php file of the theme. This isn't efficient at all and with an increase in content, the number of menus I will have to create will increase tenfold.

    So instead I would like to have one menu that just changes in the PHP file, but I'm not sure how to do this. I can provide more information on request. Thanks!

  2. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    A slightly better solution would be to use a switch statement, as opposed to 20 if statements, but you're left with the same logic.

  3. sjroda
    Posted 3 years ago #

    Yeah, I would like to have the menu check for a condition and then add an item to the menu if the condition is true. How exactly would I add an item to the menu from the PHP file?

Topic Closed

This topic has been closed to new replies.

About this Topic