Created
September 8, 2018 23:30
-
-
Save mahdiyazdani/b9d7ef363046e15a9d0672e9e5320599 to your computer and use it in GitHub Desktop.
Search field for WordPress 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
| <form method="get" class="search-form" action="<?php echo home_url( '/' ); ?>" role="search"> | |
| <label> | |
| <span class="screen-reader-text"><?php esc_html_e( 'Search for:', 'textdomain' ); ?></span> | |
| <input type="search" name="s" placeholder="<?php esc_attr_e( 'Search posts', 'textdomain' ); ?>" /> | |
| </label> | |
| <input type="submit" class="search-submit" value="<?php esc_attr_e( 'Search', 'textdomain' ); ?>" /> | |
| <input type="hidden" name="post_type" value="custom_post_type" /> | |
| </form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment