Created
May 13, 2019 14:06
-
-
Save brianpurkiss/142b854aeae639dc5a9459de21615331 to your computer and use it in GitHub Desktop.
Search Just a Custom Post Type
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
<?php /* | |
Search just a custom post type using WordPress' native search. | |
Uses Boostrap classes. | |
Swap out "CustomPostTypeHere" for your custom post type slug. | |
*/ ?> | |
<form class="form-inline" action="<?php echo home_url( '/' ); ?>"> | |
<div class="form-group mx-sm-3 mb-2"> | |
<label for="cptsearch" class="sr-only">Search</label> | |
<input type="search" class="form-control" id="cptsearch" name="s" placeholder="Search"> | |
</div> | |
<input type="hidden" name="post_type" value="CustomPostTypeHere"> | |
<button type="submit" class="btn btn-primary mb-2">Search</button> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment