Created
April 30, 2020 17:42
-
-
Save ibndawood/b0d3bf734f7837c3fc3277c0ff64a8c8 to your computer and use it in GitHub Desktop.
MyBag - Append Search Bar to Header v1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'wp_nav_menu_items', 'mybag_child_search_menu_item', 10, 2 ); | |
| function mybag_child_search_menu_item( $items, $args ) { | |
| if ( $args->theme_location === 'primary' ) { | |
| ob_start(); | |
| mybag_get_template( 'sections/mybag-search-bar.php' ); | |
| $search_form = ob_get_clean(); | |
| $items .= '<li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle"><i class="fa fa-search"></i></a><ul class="dropdown-menu" style="width:400px"><li class="menu-item menu-item-type-post_type menu-item-object-static_block animate-dropdown header-2"><div class="yamm-content" style="padding:0">' . $search_form . '<style type="text/css">.header-2 .search-area {opacity: 1;width: 100%;right:0}</style></div></li></ul></li>'; | |
| } | |
| return $items; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment