Skip to content

Instantly share code, notes, and snippets.

@jazzsequence
Created January 16, 2015 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazzsequence/0ed45d2b08275427dc00 to your computer and use it in GitHub Desktop.
Save jazzsequence/0ed45d2b08275427dc00 to your computer and use it in GitHub Desktop.
passes post_type as an array to the query string
<?php
?>
<form action="<?php echo home_url(); ?>" id="topsearchform" method="get">
<fieldset class="topsearchform">
<label for="s" class="screen-reader-text"><?php _e('Search for:', 'curated'); ?></label>
<input type="search" id="s" name="s" placeholder="" required />
<input type="hidden" name="post_type[]" value="post" />
<input type="hidden" name="post_type[]" value="song" />
<input type="hidden" name="post_type[]" value="artist" />
<input type="image" id="searchsubmit" alt="<?php _e('Search', 'curated'); ?>" src="<?php echo get_template_directory_uri(); ?>/images/searchicon.png" class="searchicon" />
</fieldset>
</form>
@jazzsequence
Copy link
Author

this is the search page template that shows these search results https://gist.github.com/jazzsequence/5a2e82f9db8b29366ba3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment