• Resolved joekober

    (@joekober)


    Hi guys.

    I have added some border radius which shows what current-item you are on, on my site (Site here).

    As you can see, when you’re on the home and you highlight over the ‘Store’ Tab it looks fine, the sub menu pops up with the css i put in. But when you click on store then re-highlight over store, the sub menu has become inherited somewhat. Is it possible to change this?

    thanks πŸ™‚

Viewing 15 replies - 1 through 15 (of 18 total)
  • Are you using a child theme or a custom CSS plugin?

    Hey there.

    I tried to take a look http://booteeki.com/test/ but you have a fatal error, you’re trying to redeclare a function (mp_list_products) twice, once from here:

    /marketpress/marketpress-includes/template-functions.php

    And then in here:

    /Booteeki Theme/functions.php

    Let me know when it’s fixed up.

    Cheers.

    Thread Starter joekober

    (@joekober)

    Hi there Timothy,

    Its back up now. Just trying to learn about the functions etc from a thread on WPMU actually hah.

    Hi Esmi, i am using a child theme.

    Thanks πŸ™‚

    Hey again.

    Probably should remove the space out of the filename there. Use a hyphen or remove the space.

    So this is the CSS you refer too?

    .site-navigation .current_page_item > a,
    .site-navigation .current_page_ancestor > a,
    .site-navigation .current-menu-item > a,
    .site-navigation .current-menu-ancestor > a {
    	color: black;
    	background-color:#C89FC1;
    	border-bottom-left-radius:85%;
    	border-bottom-right-radius:85%;
    	height:8px;
    }

    I see originally you mentioned about targeting the current item. I just looked on your site and it seems all the child items in your menu also have the same class, this is why it applies to them all and not just one.

    I tested in the default Twenty Fourteen theme that your child is based off and that behaviour doesn’t occur for child menu items unless they are actually the current page. Are you doing something custom with menus there?

    Cheers.

    Thread Starter joekober

    (@joekober)

    Hi there Timothy, thanks for getting back in touch again.

    So i have been having a play around and i can get it to change in chrome’s inspector by changing the class to just ‘sub-menu’ and delete the rest.

    I cannot work out where the code is within the PHP files though. I have looked inside header.php but i just cannot see the code where to remove the classes. Could you point me in the right direction please?

    Thanks

    Thread Starter joekober

    (@joekober)

    Or if you could guide me how to remove all the class but keep sub-menu that would be even better πŸ˜€

    Hey there.

    It’s looking like a bug in our MarketPress, they shouldn’t all be current and it seems we clone the parent in our code. Stick with me, I had a look earlier and I’ll continue looking into it shortly.

    Hopefully won’t be too long. πŸ™‚

    Take care.

    Hi there joekober,

    I’m Jose from WPMU DEV.
    Tim asked me to look into this and get you a fix.

    I found a bug in how the wp_nav_menu function is being hooked. We will push a fix as soon as possible.

    In the meantime, you can apply the fix in your installation by making the following changes into the file ..\wp-content\plugins\wordpress-ecommerce\marketpress.php:

    – In line 160 replace this:
    add_filter( 'wp_nav_menu_objects', array(&$this, 'filter_nav_menu'), 10, 2 );
    with this:
    add_filter( 'wp_get_nav_menu_items', array(&$this, 'filter_nav_menu'), 10, 2 );

    – In line 1487 replace the entire function filter_nav_menu with this fixed version:

    function filter_nav_menu($list, $menu, $args = array()) {
    		$store_object = false;
    
             if ($args->depth == 1)
                return $list;
    
                //find store page
                $store_url = mp_store_link(false, true);
                $store_page = get_option('mp_store_page');
                foreach($list as $menu_item) {
                    if ((isset($menu_item->object_id) and $menu_item->object_id == $store_page) || $menu_item->url == $store_url) {
                        $store_object = $menu_item;
                        break;
                    }
                }
    
                if ($store_object) {
                    $obj_products = clone $store_object;
                    $obj_products->title = __('Products', 'mp');
                    $obj_products->menu_item_parent = $store_object->ID;
                    $obj_products->ID = 'products-subm';
                    $obj_products->db_id = 'products-subm';
                    $obj_products->post_name = 'products-subm';
                    $obj_products->url = mp_products_link(false, true);
                    $obj_products->current = (get_query_var('pagename') == 'product_list') ? true : false;
                    $obj_products->current_item_ancestor = (get_query_var('pagename') == 'product_list') ? true : false;
                    $obj_products->menu_order = 997;
                    $obj_products->object_id = '99999999997';
                    $obj_products->object = 'custom';
                    $list[] = $obj_products;
    
                     //if cart disabled return only the products menu item
                    if ($this->get_setting('disable_cart'))
                         return $list;
    
                    $obj_cart = clone $store_object;
                    $obj_cart->title = __('Shopping Cart', 'mp');
                    $obj_cart->menu_item_parent = $store_object->ID;
                    $obj_cart->ID = 'shopping-cart-subm';
                    $obj_cart->db_id = 'shopping-cart-subm';
                    $obj_cart->post_name = 'shopping-cart-subm';
                    $obj_cart->url = mp_cart_link(false, true);
                    $obj_cart->current = (get_query_var('pagename') == 'cart') ? true : false;
                    $obj_cart->current_item_ancestor = (get_query_var('pagename') == 'cart') ? true : false;
                    $obj_cart->menu_order = 998;
                    $obj_cart->object_id = '99999999998';
                    $obj_cart->object = 'custom';
                    $list[] = $obj_cart;
    
                    $obj_order = clone $store_object;
                    $obj_order->title = __('Order Status', 'mp');
                    $obj_order->menu_item_parent = $store_object->ID;
                    $obj_order->ID = 'order-status-subm';
                    $obj_order->db_id = 'order-status-subm';
                    $obj_order->post_name = 'order-status-subm';
                    $obj_order->url = mp_orderstatus_link(false, true);
                    $obj_order->current = (get_query_var('pagename') == 'orderstatus') ? true : false;
                    $obj_order->current_item_ancestor = (get_query_var('pagename') == 'orderstatus') ? true : false;
                    $obj_order->menu_order = 999;
                    $obj_order->object_id = '99999999999';
                    $obj_order->object = 'custom';
                    $list[] = $obj_order;
                }
    
                return $list;
    	}

    Let us know if it works for you. We’ll keep you posted on the release of the fixed version.

    Cheers!

    Thread Starter joekober

    (@joekober)

    Hey JJberry.

    Thanks for providing the fix, i appreciate this very much!!

    Seems to be working as it should now. Just one thing, i now have a downwards arrow on the nav bar. How do i remove this, i have looked inside the css but cannot seem to find that pesky arrow!

    Thanks.

    Glad to hear that it works now!

    The arrow is showing up because now the class .menu-item-has-children is being added to the element, as expected.

    You should override the style for the following selectors:

    .menu-item-has-children > a
    .menu-item-has-children > a:after

    For instance, you can use the following (need testing):

    .menu-item-has-children > a {
        padding-left: 12px !important;
    }
    .menu-item-has-children > a:after {
        display: none !important;
    }

    There might be something missing. Please try and let me know.

    Cheers!

    Also, you will notice that now, when a sub-menu item is selected, it is marked as .current-menu-item. So you need to create a specific style for those as well. πŸ™‚

    Hey joekober.

    Thanks for your patience on this one, glad we could get it sorted for you. The next release should contain this fix. πŸ™‚

    Take care.

    Thread Starter joekober

    (@joekober)

    Worked a treat JJberry, again thanks for getting back to me. Just waiting for it all to sink into my head now so i can remember things.

    Thanks again Timothy too, i will see you guys on WPMU as i have a few questions here and there too πŸ™‚

    Thread Starter joekober

    (@joekober)

    Hi guys, I have found one more link which is still inheriting the current-item class.

    It all looks fine from the page link : http://booteeki.com/test/

    But if you actually go to the store-> products, (http://booteeki.com/test/store/products/) it re-appears, it goes away when i delete .current-item although could you tell me where i need to change this please πŸ™‚

    Thanks guys

    Edit: Sorry current.item shows on each of the 3 drop downs once clicked.

    Hi again joekober!

    That’s the expected behavior. As I said above:

    Also, you will notice that now, when a sub-menu item is selected, it is marked as .current-menu-item. So you need to create a specific style for those as well. πŸ™‚

    So, you can try with the following selector to define the style for the sub menu items when they are the current item:

    ul.sub-menu>li.current-menu-item {
      //override the style here.
    }

    Cheers!

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Theme: Twenty Fourteen] Changing border radius on sub menu from main nav.’ is closed to new replies.