Wordpress - Simple way to search custom-post types only
To search for a custom post type , you can add to the query &post_type=events
, to achieve this just edit your form like this
<form id="searchform" action="http://localhost:8888/ltc" method="get">
<input class="inlineSearch" type="text" name="s" value="Enter a keyword" onblur="if (this.value == '') {this.value = 'Enter a keyword';}" onfocus="if (this.value == 'Enter a keyword') {this.value = '';}" />
<input type="hidden" name="post_type" value="events" />
<input class="inlineSubmit" id="searchsubmit" type="submit" alt="Search" value="Search" />
</form>
You can do this for any post type (needs to be an existent one or will be discarded) and will work just fine