Help with Ubermenu3

Hey!

i have a Store menu and a Cart menu,
The 5776 Menu is not relevant. i actualy want the cart menu to be placed in the 5776 menu place.

Screenshot>> http://prntscr.com/jevfw3

but when i click links on the Store Menu, then on the directions of the links the Store Menu is gone and the normal nav menu appears again.

my questions are:

  1. How do i set the Store menu to appear in all the store and woocommerce links on the store menu
  2. how to i place cart menu instead of the 5776 menu position?

P.S:

I do have cart menu set up and theme location as well as the Store menu

Screenshot>> http://prntscr.com/jevhc3

Please help :slight_smile:

Hi,

1- I can see a custom code snippet is added in (functions.php) file in your child theme directory to achieve that, however, is_woocommerce conditional tag was used, and this will include WooCommerce pages that use WooCommerce Templates only, if a WooCommerce related page was created via shortcodes, then itā€™s no longer included in the is_woocommerce check, please refer to this guide as a reference.

What I suggest here is to modify the code to include other pages by IDs, for example, instead of having this line:
if ( is_woocommerce() ) {

I suggest modifying it to:
if ( is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {

Including pages IDs in the sub-menu link (of store menu), check this guide to know how to get page/post ID:

2- Thatā€™s another customization I can see you started in (/x-child/framework/legacy/cranium/headers/views/ethos/wp-header.php) file, you need to load the cart menu instead of this line:
<?php ubermenu( '5776' , array( 'theme_location' => 'Secondary-Menu' ) ); ?>

To know how to register a new menu and load it in WordPress, please check this tutorial.

As this is all custom development, regretfully we wont be able to assist further. Custom development is outside the scope of our support. Were happy to provide advice and get you started in the right direction, but you would still be responsible for the implementation. And moreover, this solution may not work after several updates especially if the themes structure changed or overridden.

Thanks.

Thanks that worked great!

in functions.php i have this code:
add_filter( ā€˜wp_nav_menu_argsā€™, ā€˜custom_blog_menuā€™ );

function custom_blog_menu( $args ) {
if ( is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
$args[ā€˜theme_locationā€™] = ā€˜Store Menuā€™;
$args[ā€˜menuā€™] = ā€˜Store Menuā€™;
}
return $args;
}

and in woocommerce it shows the same menu mentioned in the code as same different positions,
can i add the cart menu to the other positions? (perhaps in that code)

Hi,

Normally, you canā€™t pass the same $args to the same function twice, please check this filter reference and consult a developer regarding how to achieve this customization you are seeking for, as my colleague mentioned here, this is beyond our support scope.

Thanks.

Please i cannot afford a developer, is it that complicated to do? its just my last issue on the site.
how can i add another menu in that code of $args

Hi,
Sorry for that but yes it will require advanced theme modification, customizing and integrating new features into an already made product isnā€™t that easy task and maintaining this custom work isnā€™t easy as well.

Thanks for understanding.

Hey there

i have read the themeco terms of service at:

i am looking for support about ubermenu3 and woocommerce,
those are extensions and approved plugins
in the terms of service it says:

Are third party plugins supported?

We provide support for certain approved plugins. Please remember that while we provide support for approved plugins, this does not mean we can or will provide custom changes to 3rd party plugins. That would be a nightmare for you and for us. Generally speaking, we only list plugins as ā€œApprovedā€ if they are well established, well developed, and have a track record of being updated and supported by the company who created it.

Are Extensions supported?

Yes, we provide support for all Extensions including updates as they are made available from the developer. Please remember that while we provide support for approved plugins, this does not mean we can or will provide custom changes to 3rd party plugins. That would not be wise for you or us especially when it comes time to update. We do our part to communicate issues we see or that have been reported to us to the various owners of included Extensions.

so why do you say it is outside of your support scope while in the terms it says you do support those plugins.
those are not 3rd plugins, those are themeco extensions and approved plugins
Please help me out here, its not suppose to be complicated for you.

Hi,

As stated "This does not mean we can or will provide custom changes to 3rd party plugins"

While we are happy to help with the occasional quick tweak here or there, we are well into the custom development realm, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding.

1 Like

Hey!

yes you are right.
but im sorry i guess you did not understand what i were asking for.
i am not asking for custom changes to 3rd party plugin.
i am asking to add a menu in the x theme when x is shop thats all.

please i would love to get help from you.
i just want the cart to be shown on the other edge of the nav bar.

Hi,

You can try adding the code below in your child themeā€™s functions.php file


function add_cart_menu() {   
    if(x_is_shop()){
  
     wp_nav_menu( array(
       'menu'             => 'cart-menu',
        'theme_location' => 'my-shop-menu',
        'container'      => false,
        'menu_class'     => 'x-nav',
        'link_before'    => '<span>',
        'link_after'     => '</span>'
      ) );

}}
add_action( 'x_after_view_global__slider-below', 'add_cart_menu', 99 );

Make sure to change cart-menu with the name of your menu.

ā€˜menuā€™
(int|string|WP_Term) Desired menu. Accepts a menu ID, slug, name, or object.

Hope that helps

1 Like
// =============================================================================
// Sets Custom Menu For WooCommerce Shop 
// =============================================================================

add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
if ( is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'Store Menu';
    $args['menu'] = 'Store Menu';
  }
  return $args;
}

This is the code i am using.
what it does it changes all menus in that page to the store menu, are there some different ways to change the main nav menu to store menu?

Thats my x-child theme header.php code:

<?php

// =============================================================================
// VIEWS/ETHOS/WP-HEADER.PHP
// -----------------------------------------------------------------------------
// Header output for Ethos.
// =============================================================================

?>

<?php x_get_view( 'global', '_header' ); ?>

  <?php x_get_view( 'global', '_slider-above' ); ?>

  <header class="<?php x_masthead_class(); ?>" role="banner">
    <?php x_get_view( 'ethos', '_post', 'carousel' ); ?>
    <?php x_get_view( 'global', '_topbar' ); ?>
    <?php x_get_view( 'global', '_navbar' ); ?>

 <div id="star">
       <?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?> 
      <?php ubermenu( 'cart' , array( 'theme_location' => 'Cart' ) ); ?>
      <?php else : ?>
        <?php ubermenu( '5776' , array( 'theme_location' => 'Secondary-Menu' ) ); ?>
      <?php endif; ?>
    </div>

    <?php x_get_view( 'ethos', '_breadcrumbs' ); ?>
  </header>

  <?php x_get_view( 'global', '_slider-below' ); ?>
  <?php x_get_view( 'ethos', '_landmark-header' ); ?>

could i add a code or function inside there that the navbar will be changed to store menu?

Second thing is:

i manage to hide the main nav on woocommerce page with css:

    .woocommerce-page #ubermenu-nav-main-37-primary {
 display: none;
}

but my question is how exacly i show the store menu at the same spot, perhaps this could be with css as well??

Hey There,

ā€œbut my question is how exacly i show the store menu at the same spot, perhaps this could be with css as well??ā€

  • You donā€™t and you canā€™t. CSS is used to style an element. It cannot be used to change settings, swap menu locations or whatever conditions you have in mind.

If you want to swap your main menu when in WooCommerce pages or Shop page, just make sure that the store menu in this code exists and/or correct;

// =============================================================================
// Sets Custom Menu For WooCommerce Shop 
// =============================================================================

add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
if ( is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'Store Menu';
    $args['menu'] = 'Store Menu';
  }
  return $args;
}

You might need to change it to this:

// =============================================================================
// Sets Custom Menu For WooCommerce Shop 
// =============================================================================

add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
if ( x_is_shop() || x_is_product_category() || is_product_tag() || is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'store-menu';
    $args['menu'] = 'store-menu';
  }
  return $args;
}

Hope this helps for you.

hi thanks for the reply.

but this code is changing ALL the menues in woocommerce page to the store menu.

that is not good because i have two menus in woo page, the store menu and the cart menu.

what this code actualy does is changing the cart menu to the store menu therefore it shows like i have two store menus.

Hi,

You can add another filter for a different menu and location.

eg.


add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
if ( is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'store-menu';
    $args['menu'] = 'store-menu';
  }
  return $args;
}

add_filter( 'wp_nav_menu_args', 'custom_cart_menu' ,99);

function custom_cart_menu( $args ) {
if ( x_is_shop() || x_is_product_category() || is_product_tag() || is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'cart-menu';
    $args['menu'] = 'cart-menu';
  }
  return $args;
}

Hope that helps

1 Like

Hey!
Thank you! i so much appreciate your help attempts!

Have you tried go inside with credentials?
Because i have tried this and the store menu is Dominant

I have this file in x-child/framework/legacy/cranium/headers/views/ethos/wp-header.php

with the code:

<?php

// =============================================================================
// VIEWS/ETHOS/WP-HEADER.PHP
// -----------------------------------------------------------------------------
// Header output for Ethos.
// =============================================================================

?>

<?php x_get_view( 'global', '_header' ); ?>

  <?php x_get_view( 'global', '_slider-above' ); ?>

  <header class="<?php x_masthead_class(); ?>" role="banner">
    <?php x_get_view( 'ethos', '_post', 'carousel' ); ?>
    <?php x_get_view( 'global', '_topbar' ); ?>
    <?php x_get_view( 'global', '_navbar' ); ?>



<div id="cart">
 <?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?> 
  <?php ubermenu( 'cart' , array( 'theme_location' => 'Cart' ) ); ?>
   <?php else : ?>
       
      <?php endif; ?>
    </div>

 <div id="star">
       <?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?> 
    
      <?php else : ?>
        <?php ubermenu( '5776' , array( 'theme_location' => 'Secondary-Menu' ) ); ?>
      <?php endif; ?>
    </div>

    <?php x_get_view( 'ethos', '_breadcrumbs' ); ?>
  </header>

  <?php x_get_view( 'global', '_slider-below' ); ?>
  <?php x_get_view( 'ethos', '_landmark-header' ); ?>

The Line:

<div id="cart">
 <?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?> 
  <?php ubermenu( 'cart' , array( 'theme_location' => 'Cart' ) ); ?>
   <?php else : ?>

Represent the id of the cart menu and the cart menu.

however then i put the code you gave me it switches all menues in this page to the store menu.

isnt there is a way to attach the store menu to top nav menu id? the id is #x-navbar

i am attaching a video so you can see:

Hi there,

Thatā€™s because of this line

<?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?>

Check these block, and compare them

<div id="cart">
 <?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?> 
  <?php ubermenu( 'cart' , array( 'theme_location' => 'Cart' ) ); ?>
   <?php else : ?>
       
      <?php endif; ?>
    </div>
 <div id="star">
       <?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?> 
    
      <?php else : ?>
        <?php ubermenu( '5776' , array( 'theme_location' => 'Secondary-Menu' ) ); ?>
      <?php endif; ?>
    </div>

Youā€™re displaying different menu, but youā€™re targeting the same page, which is <?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?> .

Hence, on the same page, it only overrides the previous menu. How about like this

<div id="cart">
 <?php if ( x_is_shop() || x_is_product_category() || is_product_tag() ) : ?> 
  <?php ubermenu( 'cart' , array( 'theme_location' => 'Cart' ) ); ?>
   <?php else : ?>
       
      <?php endif; ?>
    </div>

It depends on where you wish to display it, and assuming cart Ubermenu and theme location exist.

Thanks!

Hey!

I have changed the code as you said.

but the code that @paul.r gave me still assign the same menu to both places, the cart and the store menues turns to be the same menu from some reason.

add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
if ( is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'store-menu';
    $args['menu'] = 'store-menu';
  }
  return $args;
}

add_filter( 'wp_nav_menu_args', 'custom_cart_menu' ,99);

function custom_cart_menu( $args ) {
if ( x_is_shop() || x_is_product_category() || is_product_tag() || is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'cart-menu';
    $args['menu'] = 'cart';
  }
  return $args;
} 

I just want that the Store menu to be places instead of the top nav primary menu
and that the menu on the left side will be the cart menu.

the ID in this code in wpheader.php #star and #cart are same position. its just that cart is shown in shop page and star shown in rest of pages which are not shop.

please help me switch main menu (x-navbar) to store menu (store-menu) and the star menu (5776) with cart menu (cart).

This is the code i have in wpheader.php right now currently:

<?php

// =============================================================================
// VIEWS/ETHOS/WP-HEADER.PHP
// -----------------------------------------------------------------------------
// Header output for Ethos.
// =============================================================================

?>

<?php x_get_view( 'global', '_header' ); ?>

  <?php x_get_view( 'global', '_slider-above' ); ?>

  <header class="<?php x_masthead_class(); ?>" role="banner">
    <?php x_get_view( 'ethos', '_post', 'carousel' ); ?>
    <?php x_get_view( 'global', '_topbar' ); ?>
    <?php x_get_view( 'global', '_navbar' ); ?>

<div id="cart">
 <?php if ( x_is_shop() || x_is_product_category() || is_product_tag() ) : ?> 
  <?php ubermenu( 'cart' , array( 'theme_location' => 'Cart-Menu' ) ); ?>
   <?php else : ?>
       
      <?php endif; ?>
    </div>

 <div id="star">
       <?php if (is_woocommerce() || is_page( array( 3010, 3007 ) ) ) : ?> 
    
      <?php else : ?>
        <?php ubermenu( '5776' , array( 'theme_location' => 'Secondary-Menu' ) ); ?>
      <?php endif; ?>
    </div>

    <?php x_get_view( 'ethos', '_breadcrumbs' ); ?>
  </header>

  <?php x_get_view( 'global', '_slider-below' ); ?>
  <?php x_get_view( 'ethos', '_landmark-header' ); ?>

Thanks for the help! in advance!

Adding a Video of what i did:

please feel free to test in store page.
Adding additional information needed in Secure note.

Hi,

Your code is redundant, you are doing the conditional both in wp-header and in your child theme.

Please change your code in your wp-header to this.

<?php

// =============================================================================
// VIEWS/ETHOS/WP-HEADER.PHP
// -----------------------------------------------------------------------------
// Header output for Ethos.
// =============================================================================

?>

<?php x_get_view( 'global', '_header' ); ?>

  <?php x_get_view( 'global', '_slider-above' ); ?>

  <header class="<?php x_masthead_class(); ?>" role="banner">
    <?php x_get_view( 'ethos', '_post', 'carousel' ); ?>
    <?php x_get_view( 'global', '_topbar' ); ?>
    <?php x_get_view( 'global', '_navbar' ); ?>

<div id="cart">

  <?php ubermenu( 'cart' , array( 'theme_location' => 'Cart-Menu' ) ); ?>

    </div>

 <div id="star">
     
        <?php ubermenu( '5776' , array( 'theme_location' => 'Secondary-Menu' ) ); ?>

    </div>

    <?php x_get_view( 'ethos', '_breadcrumbs' ); ?>
  </header>

  <?php x_get_view( 'global', '_slider-below' ); ?>
  <?php x_get_view( 'ethos', '_landmark-header' ); ?>

Then do your conditional statements in your child theme.


add_filter( 'wp_nav_menu_args', 'custom_blog_menu' );

function custom_blog_menu( $args ) {
if ( is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'secondary-menu';
    $args['menu'] = 'secondary-menu';
  }
  return $args;
}

add_filter( 'wp_nav_menu_args', 'custom_cart_menu' ,99);

function custom_cart_menu( $args ) {
if ( x_is_shop() || x_is_product_category() || is_product_tag() || is_woocommerce() || is_page( array( 3010, 3007 ) ) ) {
    $args['theme_location'] = 'cart-menu';
    $args['menu'] = 'cart-menu';
  }
  return $args;
}

Please change the menu location and menu accordingly.

Hope that helps.

1 Like

Hey

I am realy happy that you are attempting to help and very much appreciate this!
Unfortunately that didnt help.
in homepage i have 2 menues >> http://prntscr.com/jhr8fm

and in Shop i have 3 menues which are the same menu = cart >> http://prntscr.com/jhr8wq

I realy wish to solve this issue, that is actualy my last issue i am conflicting on my website, after this will be solved my website can be launched.

Please feel free to use credentials and test things there to solve this issue,
i have added ftp credentials for the wpheader.php and login as administrator one

cant we modify the wpheader.php code so the #x-navbar main menu will be replaced with the store one then add the cart on the side?

Thanks!