Wordpress display menu5/8/2023 Today, I will demonstrate how to add menu descriptions for any theme using two methods. The coding method requires a bit more work than the plugin, but it does save you from installing another plugin. You can either use a plugin or write some code to achieve the same results. However, it may prove difficult depending on the method you choose. This is because the feature is off by default, which doesn’t make much sense.īut don’t worry, you can turn it on. For starters, you will see this feature available on the menu page, but enabling it does not work. If you want to show totally different menus to members of different membership level then you can do that too.Do you want to add descriptions to your WordPress menus? This seems like a basic feature that WordPress would support and it does, but it is quite tricky to enable. ?> Show Different Menus to Different Membership Levels Wp_nav_menu( array( 'menu' => 'normal-visitor-menu', 'container_class' => 'menu-header' )) WordPress Twenty Ten Theme: Use the following block of code for step 6 if you are using the WordPress Twenty Ten theme: 'logged-in-members', 'container_class' => 'menu-header' )) Wp_nav_menu( array( 'menu' => 'normal-visitor-menu' ) ) Step 6) Once you have identified the block of code that is displaying your navigation menu, replace that code with the following block of code which will output the menus we already created dynamically: 'logged-in-members' ) ) Generally the navigation menu code resides in the “header.php” template file of your theme.Įxample 1: The following line of code in the “header.php” file outputs the navigation menu in the WordPress Twenty Ten theme: 'menu-header', 'theme_location' => 'primary' ) ) ?>Įxample 2: The following line of code in the “header.php” file outputs the navigation menu in the WordPress Twenty Eleven theme: 'primary' ) ) ?> Step 5) Find the block of code in your theme that is displaying your navigation menu (you can ask your theme developer where this line of code is). Utilizing the Newly Created Menus in Your Theme That gives you two WordPress menus (one for the members and one for everyone else). Step 4) Add whatever menu items you want to show to your normal visitors in this newly created menu and then save this menu. Step 1) Go to the “Appearance -> Menus” section in your WordPress dashboard and create a new menu with the name “ logged-in-members” (we want to show this menu to our logged in members)Ĭreate another menu for the normal visitors
0 Comments
Leave a Reply. |