-
-
Save srikat/eeac02a9f2de43473175 to your computer and use it in GitHub Desktop.
Animated Search form in Minimum Pro. https://sridharkatakam.com/animated-search-form-in-minimum-pro/
This file contains 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
//* Reposition the primary navigation menu | |
remove_action( 'genesis_after_header', 'genesis_do_nav' ); | |
add_action( 'genesis_after_header', 'genesis_do_nav', 15 ); |
This file contains 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
// Remove the header right widget area | |
unregister_sidebar( 'header-right' ); | |
// Reposition the primary navigation menu | |
remove_action( 'genesis_after_header', 'genesis_do_nav' ); | |
// add_action( 'genesis_after_header', 'genesis_do_nav', 15 ); | |
add_action( 'genesis_header', 'genesis_do_nav' ); | |
add_filter( 'wp_nav_menu_items', 'theme_menu_extras', 10, 2 ); | |
/** | |
* Filter menu items to append a search form. | |
* | |
* @param string $menu HTML string of list items. | |
* @param stdClass $args Menu arguments. | |
* | |
* @return string Amended HTML string of list items. | |
*/ | |
function theme_menu_extras( $menu, $args ) { | |
if ( 'primary' !== $args->theme_location ) | |
return $menu; | |
$menu .= '<li class="search"><a id="main-nav-search-link" class="icon-search"></a><div class="search-div">' . get_search_form( false ) . '</div></li>'; | |
return $menu; | |
} | |
// Customize search form input button text | |
add_filter( 'genesis_search_button_text', 'sp_search_button_text' ); | |
function sp_search_button_text( $text ) { | |
return esc_attr( 'Go' ); | |
} |
This file contains 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
/* | |
Animated Search Form | |
---------------------------------------------------------------------------------------------------- */ | |
.nav-primary { | |
background: transparent; | |
float: right; | |
} | |
.nav-primary a, | |
.nav-primary .genesis-nav-menu .sub-menu a { | |
color: #333; | |
} | |
.nav-primary .genesis-nav-menu .sub-menu a { | |
background-color: #fff; | |
border: 1px solid #eee; | |
border-top: none; | |
} | |
.nav-primary .genesis-nav-menu .sub-menu a:hover { | |
color: #0ebfe9; | |
} | |
.nav-primary .genesis-nav-menu > .search { | |
display: inline-block; | |
position: relative; | |
width: auto; | |
padding: 0; | |
} | |
li a.icon-search:before { | |
font-family: FontAwesome; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: inherit; | |
content: "\f002"; | |
} | |
li a.icon-search { | |
cursor: pointer; | |
} | |
.search-div { | |
display: none; | |
position: absolute; | |
z-index: 10; | |
right: 0; | |
width: 300px; | |
padding: 10px; | |
-webkit-border-radius: 0 0 6px 6px; | |
border-radius: 0 0 6px 6px; | |
background: #f2efef; | |
} | |
.search-div .search-form { | |
position: relative; | |
margin-top: 0; | |
} | |
.search-div .search-form input[type="search"] { | |
width: 100%; | |
padding: 10px; | |
font-size: 16px; | |
} | |
.search-div .search-form input[type="submit"] { | |
right: 3px; | |
padding: 12px 14px; | |
clip: auto; | |
width: auto; | |
height: auto; | |
margin: 0; | |
} | |
/* Clear search field placeholder text on focus */ | |
input:focus::-webkit-input-placeholder { | |
color: transparent; | |
} | |
input:focus:-moz-placeholder { | |
color: transparent; | |
} /* Firefox 18- */ | |
input:focus::-moz-placeholder { | |
color: transparent; | |
} /* Firefox 19+ */ | |
input:focus:-ms-input-placeholder { | |
color: transparent; | |
} /* oldIE ;) */ | |
@media only screen and (max-width: 1023px) { | |
.title-area, | |
.nav-primary { | |
float: none; | |
} | |
.nav-primary { | |
text-align: center; | |
} | |
.site-header .search-form { | |
width: 100%; | |
} | |
} | |
@media only screen and (max-width: 768px) { | |
.nav-primary { | |
margin-top: 10px; | |
} | |
} | |
@media only screen and (max-width: 320px) { | |
.search-div { | |
right: -86px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment