My search results are limited to post types book
and author
. The following code in search.php
displays all author
posts first, then all book
posts (I asked why post types are separated like that, but got no answer so far):
while(have_posts()) : the_post();
if ( 'book-author' == get_post_type() ) {
?>
<h2>AUTHOR</h2>
<?php the_title();
}
elseif ( 'book' == get_post_type() ) {
?>
<h2>BOOK</h2>
<?php the_title();
}
endwhile;
However I want to display these search results in two columns entitled "BOOKS" and "AUTHORS", each in its own div
element. This code doesn't allow that, so how can I achieve such division?