Last active
August 29, 2015 14:05
-
-
Save srikat/63c121b7938406aec50a to your computer and use it in GitHub Desktop.
How to display Search box within content in WordPress. http://sridharkatakam.com/display-search-box-within-content-wordpress/
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 | |
//* Do NOT include the opening php tag | |
//* Create a [my_search] shortcode for displaying search box | |
add_shortcode('my_search', 'display_search'); | |
function display_search($atts) { | |
ob_start(); | |
echo '<div class="my-search">'; | |
get_search_form(); | |
echo '</div>'; | |
return ob_get_clean(); | |
} |
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
.my-search { | |
margin-bottom: 28px; | |
} | |
.my-search input[type="search"] { | |
max-width: 300px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment