I am able to sort search results by post type with the following code below.
I need help customizing the results based on post types.
For example, if $type == ‘services’, I need to print just the title w/o the link. How can I do that?
if( have_posts() ) {
$types = array(‘services’, ‘solutions’, ‘page’);
foreach( $types as $type ){
if ( $type == ‘services’ ) {
echo ‘<h2>Services</h2>’;
} elseif ( $type == ‘solutions’ ) {
echo ‘<h2>Solutions</h2>’;
} else {
echo ‘<h2>Other</h2>’;
}
while( have_posts() ){
the_post();
if( $type == get_post_type() ){
printf( ‘<h2><a href=”%s”>%s</a></h2>’, esc_url( get_permalink() ), esc_html( get_the_title() ) );
the_excerpt();
}
}
rewind_posts();
}
}

Just use a case statement and step through each post type and output whatever you want accordingly.
So if the post type is your “services”, then just output <h2>Services</h2> or whatever you want.