I have wordpress + woocommerce site which is using Divi theme. All divi pages I built using custom page builder but it canot be used on posts or singe-product.php page. In most of the pages I added custom menu using divi builder(it’s like shortcode element) and I want to add it to product page but I can’t figure out how.
I’ve 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 primary menu (menu_id=”35″ is custom)
another option I thinked of would be wp_nav_menu( array( ‘menu’ => ‘$custom’) );
but I can’t figure out how to wrap it to all these divi classes.
Here’s the html code for 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’m new in wordpress and it’s my first site with it. And the menu is different based on product category.
Here’s the link http://gamehub.lt/xbox/xbox-one/ menu one
http://gamehub.lt/playstation/playstation-4-2/ another.
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. It is the easiest way to get custom menu on all pages.
Sorry if i am not understanding you question but what i understand is that you want to show a custom menu in your theme.
First you need to register a navigation menu on functions.php , you can use that code to register your new menu :
After that you need to display your new menu in theme header , you can use that code :