i think you can PHP it using an if statement.. like so:
Say this is the loop.. (simple one i know):
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$post_type = get_post_type_object( get_post_type($post) );
$post_type_name = $post_type->labels->singular_name
if ($post_type_name == 'example') {
echo '<div class="highlight searchResults">';
} else {
echo '<div>';
?>
<h3><?php the_title(); ?></h3>
<p><?php the_excerpt(); ?></p>
</div>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
.
Dont forget to change the ‘example’ with the singular name of the custom post type you are checking for in the search restuls…
Hope this helps 🙂
Related Posts:
- WooCommerce product search titles only
- filter custom post type by meta key in dashboard
- WordPress sort search results by custom order
- search suggest – filter post type
- Search filter triggered & sort by custom post type
- Custom Search Template for Custom Post Types
- Diffrent search templates for different post types
- creat filter with wp_query
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Including metaboxes from custom post types in global search — continued
- Custom post type not showing in search result
- How can I made custom taxonomies relationship?
- WooCommerce sort products by the actual product width(not the shipping width)
- How to change the post type a theme shows by default?
- filter custom post in rest api with custom function
- What to and how to proceed with CPT to make DB small and efficient?
- Pretty URL for custom search for custom post type
- Filter hierarchical custom post type admin page by parent, and include children & grandchildren
- Sort and filter custom post type posts by custom taxonomy
- Add post location with mile radius allowing search
- Versioned Custom Post Type (Not the same as revisions)
- Include custom post type content in search
- Get post count for search result based on post type
- Auto Complete Search
- Loop filtering Custom Post Types and/or Categories
- Searching Custom Post Types
- the_content filter on some post types only not working
- Filtering posts list table
- How do i search authors from search form using author’s name
- Custom filter function not working with Custom post type
- Filter Posts from the Main Query
- Remotely search WordPress sites using xml-rpc
- Categories filtering in new post
- How to use manage_$post_type_posts_columns with underscore in post type?
- BBPress Search results in WordPress search
- Limit Search to Post Type With Apostrophe return search not found
- How does the filter post_updated_messages work?
- Set Custom Post Type in Widget Settings for use in Widget
- How to order posts of a custom post type by date DESC in dashboard Admin?
- Displaying and searching Custom Posts
- Search by tag name and category
- Searching Custom Fields
- Advanced search form with filters for custom taxonomies
- dropdowboxes with pre-selected custom fields optios that filters the results according seach needs
- filter search custom field query
- Different results between permalink and query var search
- How to let users choose where to search for posts?
- WordPress Custom Search by post_type
- Include custom taxonomy term in search
- How can I add a filter to a particular post format?
- What content types are shown at a search page?
- Can NOT search my custom post type?
- Is there any way to get list of all possible filter hooks for all post types?
- Can I display custom post types in home.php or need page template?
- Search one custom post type ONLY, disable “all posts”
- Create new custom post and post category of same name
- wordpress remove views from action links in a custom post
- Custom post_type search pages
- Pagination Error : Duplicate argument being outputted
- WordPress search and date filter not working with custom post type
- Custom Empty Results page for my Custom Post Type
- wp_insert_post wrong post type [closed]
- Filter posts by tax (dropdown) and meta value
- Custom filter for main search: how to exclude specific post_type from search results
- Add custom attributes to a post
- Display an icon based on post type
- How can I remove filters from custom post types?
- sortable columns for multiple custom post types not working
- I need to add a filter to prepend the term ‘National – ‘ to the post title if the post is tagged to multiple states
- how to get this tax_query working?
- Select2 AJAX and WP Query Returns ALL and does not filter
- Custom Taxonomy Search result page
- How to group search results by post type and only if post type result is not empty?
- find custom post type post by searching its custom field with my string
- How do I add custom HTML to the content of an archive page’s posts?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- REST filters only firing when I have a param set
- search custom post type by custom fields on front end
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- Category Search / Custom Post Type search on my website. Custom Post Types that are “page-like”?
- Custom Search | check multiple meta_value for search value
- Hide custom post type from search based on custom taxonomy
- Problem with Apply Filters on URL in meta box filed of custom port type
- how to retain the ability to modify the post slug after applying a post_type_link filter?
- What is the correct term for a tool that filters content based on metadata?
- Pagination on search results page
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- Ideas on how to organize a project [closed]
- How to filter url on post submission?
- Best way to create a search for custom post type by custom field values
- Modifying WP_Title For Custom Post Type
- Filtering custom posts by custom fields (ACF) [closed]
- Filtering the_content, but still need to display the unfiltered content inside filter
- Searching post types
- Blank search results on custom search
- Multi Parameter search with custom post type category and tag
- CPT, meta-data, url parameter
- Change Custom Post Type singular_name through function/filter
- Limit search field to just search a custom post type with custom fields
- Modify a plugin function output from another plugin