I have a defined set of seven different post types and would like to display an icon for each one in the search results list.
I’ve got the following code to display the post type but have no idea how to extend it into an if
<?php $post_type = get_post_type_object( get_post_type($post) );
echo $post_type->label ; ?>
Any help appreciated.
You can display different icons like this:
Even better, if you included post type names in icon filenames, you can simply insert post type in the
srcattrib in ofimgtag: