Support » Fixing WordPress » Modifying search results based on post_type

  • Is there an easy way to highlight search results based on post_type?

    I am using Job Manager plugin and when a site search is performed, I want to simply add a note e.g. (Job) next to the Job Results.

Viewing 1 replies (of 1 total)
  • The specifics depend on the theme you’re using, but you can use get_post_type() in your search loop to check the post type. Something like this would work:

    if ( 'your-custom-post' == get_post_type() ) {
        /* Title for this custom post type */
    } else {
        /* Title for everything else */
Viewing 1 replies (of 1 total)
  • The topic ‘Modifying search results based on post_type’ is closed to new replies.