<form class="search-from-wp" role="search" method="get" id="searchform" action="<?php echo home_url( '/' ) ?>">
<input class="search-field-wp" type="text" placeholder="Поиск" value="<?php echo get_search_query(); ?>" name="b" id="b" />
<span class="search-submit-wp-wrap">
<button class="search-submit-wp" type="submit" id="searchsubmit" value=""><i class="icon-search-wp fa fa-search">
</i></button>
</span>
</form>
<?php while ( have_posts() ) : the_post(); ?>
<li>
<?php
if ($post->post_type == "cards") {
//do fancy things
}
if ($post->post_type == "mycards") {
//do fancy things
}
else {
//otherwise just sit
}
<article>
<h2><a href="<?php esc_url( the_permalink() ); ?>" title="Permalink to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<time datetime="<?php the_time( 'Y-m-d' ); ?>" pubdate><?php the_date(); ?> <?php the_time(); ?></time> <?php comments_popup_link('Leave a Comment', '1 Comment', '% Comments'); ?>
<?php the_content(); ?>
</article>
?>
</li>
pre_get_posts
add_action( 'pre_get_posts', 'pre_search_filter' );
function pre_search_filter( $query ){
if ( !is_admin() && $query->is_main_query() && $query->is_search ) {
$query->set( 'orderby', 'type' );
}
}