I need a code to create a search form that only search on one custom post type I want, and also display the result in the same page (is using a template) not on search.php.
I mean, the custom post type I create is companies, and want the user can make a search in the companies page (it use companies template that shows only companies custom post types) and the result of they search only shows companies not post, pages or other kind of content.
Hope with this is more clear. :P
rhand answers:
Here is a [[LINK href="http://wordpress.stackexchange.com/questions/7651/custom-search-by-post-data-and-post-metadata"]]link[[/LINK]] to a similar discussion. You could create a page template for a custom search page and use WP_Query to grab search results you need. See also http://codex.wordpress.org/Function_Reference/WP_Query#Custom_Field_Parameters
Pali Madra answers:
Use this code and it should work if there is one custom post type.
<input type="hidden" name="post_type" value="post type name" />
Let me know if this works!
Cheers,
Pali Madra
Pancho Pérez comments:
One and only?, and where the result will show ?