Forked from iqbalrony/search-form-for-special-post-type.php
Created
July 28, 2025 10:56
-
-
Save dexit/aa0777038a8361c045d4b6fbc23d71c6 to your computer and use it in GitHub Desktop.
Search form for special 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
| <!-- search for special one post type --> | |
| <div class="search-form"> | |
| <form role="search" method="get" class="search-form mc-form bottom" action="<?php echo esc_url( home_url( '/' ) ); ?>"> | |
| <input type="search" class="search-field" placeholder="<?php esc_html_e( 'Enter your keyword', 'text-domain' ) ?>" value="<?php echo esc_attr( get_search_query() ); ?>" name="s" /> | |
| <input type="hidden" name="post_type" value="product"> | |
| <button type="submit" class="search-submit"><span class="ti ti-search"></span></button> | |
| </form> | |
| </div> | |
| <!-- search for special two or more post type --> | |
| <div class="search-form"> | |
| <form role="search" method="get" class="search-form mc-form bottom" action="<?php echo esc_url( home_url( '/' ) ); ?>"> | |
| <input type="search" class="search-field" placeholder="<?php esc_html_e( 'Enter your keyword', 'text-domain' ) ?>" value="<?php echo esc_attr( get_search_query() ); ?>" name="s" /> | |
| <input type="hidden" name="post_type" value="book"> | |
| <input type="hidden" name="post_type" value="movie"> | |
| <button type="submit" class="search-submit"><span class="ti ti-search"></span></button> | |
| </form> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment