I have a search page that is the code below, it returns different post types based upon a user search, Is there a way I can add the following title to each post type that is found - everything I've tried only adds it to every item (I'm guessing its the loop).
Custom post type 1 results - title 1 that I need to add
--- Results 1 found here
Custom post type 2 results - title 2 that I need to add
--- Results 2 found here
Here is my current code:
<?php if (is_search()) { ?>
<?php if (get_post_type() == 'type_1') {
//Style type_1 ?>
<div id="type_1" <?php post_class(); ?>>
<div id="file-loader"> <a href="<?php echo get_content_link( get_the_content() ); ?>">
<?php the_post_thumbnail(180, 230); ?>
</a>
</div>
<div id="file-hover"></div>
<h4>
<a href="<?php echo get_content_link( get_the_content() ); ?>"><?php the_title(); ?></a>
</h4>
</div>
<?php
} else if (get_post_type() == 'type_2') {
//Do different styling
}//endif
else { }
?>