-
Author
-
June 28, 2015 at 19:46 #65357avaloncakesParticipant
So I have different primary menus for non-members and members… the search and cart icon show up in the primary for the non-members but do not some up in the members’s menu. It is a plugin via PMPro that allows me to make multiple menus for this.
June 28, 2015 at 22:21 #65365sharmstrModeratorThe Kleo logic behind the cart looks for the menu that you have set as your primary or top menu. Lets stick with primary in this case since that’s what youre after. Anyhoooo, I’m assuming you have the non-member set as your primary menu in Appearance > Menu. I’ll also assume that PMPro filters the menu to switch it out when someone is logged in. BUT as far as Kleo is concerned, non-members menu is still the primary menu…. because technically it is.
So, if all of that is correct, then I’d say you’ll have to figure out how PMPro filters the menu and add the kleo magic to it.
Here’s how Kleo does is
COPY CODE/*************************************************** :: Header menu cart ***************************************************/ if ( sq_option( 'woo_cart_location', 'primary' ) != 'off' ) { add_filter( 'wp_nav_menu_items', 'kleo_woo_header_cart', 9, 2 ); } if(!function_exists('kleo_woo_header_cart')) { /** * Add search to menu * @param string $items * @param oject $args * @return string */ function kleo_woo_header_cart ( $items, $args ) { $cart_location = sq_option( 'woo_cart_location', 'primary' ); if ( $args->theme_location == $cart_location ) { $items .= kleo_woo_get_mini_cart(); } return $items; } }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
June 28, 2015 at 22:45 #65372sharmstrModeratorOkay, I’ve been playing with this. But obviously cant test it. So, disable the cart in theme options. Then try this in your child’s functions.php file.
COPY CODEadd_filter( 'wp_nav_menu_items', 'add_cart_to_menu', 9, 2 ); function add_cart_to_menu ( $items, $args ) { if ( $args->theme_location != 'top' ) { $items .= kleo_woo_get_mini_cart(); } return $items; }
Again, I have no idea how pmpro is doing the menu switch so it may not work. But it does add the cart to my primary menu even with it disabled in Theme Options.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
June 28, 2015 at 23:16 #65375avaloncakesParticipantSo that put an extra shopping cart on the “primary” (non-members menu) and put just the shopping cart on the members menu… no search bar.. but looks like we’re headed in the right direction 🙂
June 28, 2015 at 23:32 #65378sharmstrModeratorIt shouldnt put an extra one on the primary if you’ve disabled it in theme options. I’ve only given you the cart code so far.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
June 28, 2015 at 23:39 #65380avaloncakesParticipantAh sorry missed that part! Works like a charm! Perfect! Is adding the search just as simple?
June 28, 2015 at 23:59 #65386sharmstrModeratorI dont know. LOL. I’ll get back to you.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
June 29, 2015 at 19:51 #65560sharmstrModeratorBasically the same code/concept. Turn off the search in Theme Options > Header, then add this code to your functions.php file.
COPY CODEadd_filter( 'wp_nav_menu_items', 'add_search_to_menu', 10, 2 ); function add_search_to_menu( $items, $args ) { if ( $args->theme_location != 'top' ) { $form = kleo_get_search_menu_item(); $items .= '<li id="nav-menu-item-search" class="menu-item kleo-search-nav">' . $form . '</li>'; } return $items; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
July 2, 2015 at 20:02 #66247avaloncakesParticipantWorked perfectly! One last thing… is there anyway to turn it off on the top bar and only have it on the main menu?
July 2, 2015 at 20:37 #66252sharmstrModeratorIts already coded to do that. Its not showing up on my top bar. That’s what the if ( $args->theme_location != ‘top’ ) { line does
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
July 2, 2015 at 20:39 #66253avaloncakesParticipantAhh, it’s not showing up in my main top bar but it is showing up in my member’s top bar. I can work around that though! Thanks for all your help, very much appreciated!
July 2, 2015 at 22:22 #66262sharmstrModeratoroohhhh. Got it. Lemme look into that. sorry
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.