Created
April 26, 2014 22:30
-
-
Save sethrubenstein/11332891 to your computer and use it in GitHub Desktop.
Proper WordPress Search Box
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
<?php | |
/** | |
* Theme Default Search Box | |
*/ | |
?> | |
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> | |
<div id="searchsubmit" class="dashicons dashicons-search" /></div> | |
<input type="search" value="" name="s" id="s" placeholder="Search"/> | |
<input type="submit" id="submitsearch" value=""/> | |
<script> | |
jQuery(document).ready(function($) { | |
jQuery( "#searchsubmit" ).on( "click", function() { | |
jQuery( "#submitsearch" ).trigger( "click" ); | |
}); | |
}); | |
</script> | |
</form> |
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
#searchform { | |
input[type="search"] { | |
resize: none; | |
} | |
input[type="submit"] { | |
height: 0px; | |
padding: 0px; | |
width: 0px; | |
opacity: 0; | |
} | |
#searchsubmit { | |
position: relative; | |
float: right; | |
margin-bottom: -20px; | |
padding-top: 8px; | |
margin-right: 10px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment