Wordpress shows custom theme-style menus

I have a wordpress + woocommerce site that uses the Divi theme. All divi pages that I created using the custom page builder but cannot be used on posts or the singe-product.php page. On most pages, I added a custom menu using the divi builder (it's kind of a shortcode element) and I want to add it to the product page, but I can't figure out how to do this.

I tried this:

<?php echo do_shortcode('[et_pb_section admin_label="Section" fullwidth="on" specialty="off"][et_pb_fullwidth_menu admin_label="Fullwidth Menu" menu_id="35β€³ background_color="#ffffff" background_layout="light" text_orientation="left" submenu_direction="downwards" fullwidth_menu="off" dropdown_menu_animation="fade"] [/et_pb_fullwidth_menu][/et_pb_section] '); ?> 

but I don’t know why it shows the main menu (menu_id = "35" is normal)

another option I was thinking about would be wp_nav_menu (array ('menu' => '$ custom')); but I can't figure out how to wrap it with all of these divi classes.

Here is the html code for the menu

 <div class="et_pb_section et_pb_fullwidth_section et_pb_section_0 et_section_regular et_pb_scroll_0"> <div class="et_pb_fullwidth_menu et_pb_module et_pb_bg_layout_light et_pb_text_align_left et_dropdown_animation_fade et_pb_fullwidth_menu_0" style="background-color: #ffffff;" data-bg_color="#ffffff"> <div class="et_pb_row clearfix"> <nav class="fullwidth-menu-nav"><ul id="menu-xbox" class="fullwidth-menu nav downwards" style="background-color: rgb(255, 255, 255);"><li id="menu-item-222" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-222"><a href="http://gamehub.lt/xbox/xbox-one/">Xbox One</a></li> <li id="menu-item-219" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-219"><a href="http://gamehub.lt/xbox/xbox-360/">Xbox 360</a></li> <li id="menu-item-221" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-221"><a href="http://gamehub.lt/xbox/games/">Games</a></li> <li id="menu-item-220" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-220"><a href="http://gamehub.lt/xbox/accessories/">Accessories</a></li> </ul></nav> <div class="et_mobile_nav_menu"> <a href="#" class="mobile_nav closed"> <span class="mobile_menu_bar"></span> <ul id="mobile_menu1" class="et_mobile_menu" style="background-color: rgb(255, 255, 255);"><li id="menu-item-222" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-222 et_first_mobile_item"><a href="http://gamehub.lt/xbox/xbox-one/">Xbox One</a></li> <li id="menu-item-219" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-219"><a href="http://gamehub.lt/xbox/xbox-360/">Xbox 360</a></li> <li id="menu-item-221" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-221"><a href="http://gamehub.lt/xbox/games/">Games</a></li> <li id="menu-item-220" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-220"><a href="http://gamehub.lt/xbox/accessories/">Accessories</a></li> </ul></a> </div> </div> </div> </div> 

I am new to Wordpress and this is my first site with it. And the menu differs depending on the product category. Here is the link http://gamehub.lt/xbox/xbox-one/ of the menu one http://gamehub.lt/playstation/playstation-4-2/ another.

+5
source share
2 answers

hi You can directly paste the short code on header.php using php do short code, you can get the menu on all pages and hide the theme menu. This is the easiest way to get a custom menu on all pages.

0
source

Sorry if I do not understand you, but I understand that you want to show a custom menu in your topic.

First you need to register the navigation menu on functions.php, you can use this code to register a new menu:

 function register_my_menu() { register_nav_menu('header-menu',__( 'Header Menu' )); } add_action( 'init', 'register_my_menu' ); 

After that, you need to display a new menu in the topic title, you can use this code:

 <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?> 
0
source

Source: https://habr.com/ru/post/1243356/


All Articles