There is not “blog” folder in WordPress and the search is not done in folders, it is done in the database. I assume you mean limit the search to standard post types.
You could add post_type
argument to the search form to include only the standard post type:
<form method="get" class="searchform" action="<?php echo esc_url(home_url()); ?>/">
<input type="text"
value="<?php _e( 'Search', 'solofolio' ); ?>"
name="s"
id="s"
onblur="if (this.value == '') {this.value="Search";}"
onfocus="if (this.value == 'Search') {this.value="";}" />
<inptu type="hidden" value="post" name="post_type" />
<span><button type="submit" class="sidebar-search fa fa-search"></button></span>
</form>
Or better, hook in pre_get_post
:
add_action( 'pre_get_post', function( $query ) {
if( $query->is_main_query() && !is_admin() && $query->is_search ) {
//You can include more post types here if you want
$query->set( 'post_type', array( 'post' ) );
}
});
Or even better, and the best way to exclude post types from search, just set the exclude_from_search
argument to true
when registering the post type.