Community Forums › Forums › Archived Forums › General Discussion › Possible to add search and login button, etc. to before header menu
- This topic has 3 replies, 2 voices, and was last updated 6 years, 10 months ago by Victor Font.
-
AuthorPosts
-
June 14, 2017 at 1:44 pm #207742[email protected]Participant
Wondering how or if it's possible to add search icons, social media, icons, login button, etc., to before header menu in Magazine Pro, etc.
My client wants something like you see on the Washington Post or New York Times websites.
http://802health.comJune 14, 2017 at 2:45 pm #207748Victor FontModeratorYou can add what you'd like using Genesis Simple Hooks. If you don't want to use the plugin, you'd have to create a new widget area hooked into before_header. This article explains how to add a new widget area. The article is written for the News Pro theme, but the process is the same for any Studio Press theme: https://victorfont.com/add-widget-areas-to-news-pro-theme/
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?June 15, 2017 at 10:07 am #207798[email protected]ParticipantThanks Victor but is it possible to add the items I mentioned directly into the header menu itself, for example, to the left or right of the page links?
June 15, 2017 at 3:08 pm #207821Victor FontModeratorOnly through PHP code. I don't have an specific example I can share with you, but this is all handled through WordPress functions anywhere. The example below is how I add a cart to the menu when using WooCommerce. You might be able to figure out how to use your code to replace the cart.
function houseplans_wcmenucart($menu, $args) { // Check if WooCommerce is active and add a new item to a menu assigned to Shop Menu location if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) || 'primary' !== $args->theme_location ) return $menu; ob_start(); global $woocommerce; $viewing_cart = __('View your shopping cart', 'shdplans'); $start_shopping = __('Start shopping', 'shdplans'); $cart_url = $woocommerce->cart->get_cart_url(); $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) ); $cart_contents_count = $woocommerce->cart->cart_contents_count; $cart_contents = sprintf(_n('%d item', '%d items', $cart_contents_count, 'shdplans'), $cart_contents_count); $cart_total = $woocommerce->cart->get_cart_total(); // Uncomment the line below to hide nav menu cart item when there are no items in the cart // if ( $cart_contents_count > 0 ) { /* if ($cart_contents_count == 0) { $menu_item = '<li class="menu-item right"><a class="houseplanscart-contents" href="'. $shop_page_url .'" title="'. $start_shopping .'" itemprop="url">'; } else { */ $menu_item = '<li class="menu-item right"><a class="houseplanscart-contents" href="'. $cart_url .'" title="'. $viewing_cart .'" itemprop="url">'; /* } */ $menu_item .= $cart_contents.' - '. $cart_total; $menu_item .= '</a></li>'; // Uncomment the line below to hide nav menu cart item when there are no items in the cart // } echo $menu_item; $cart = ob_get_clean(); return $menu . $cart; }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet? -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.