WordPress.org

Ready to get started?Download WordPress

Forums

Modifying search results based on post_type (2 posts)

  1. whitsey
    Member
    Posted 2 years ago #

    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.

  2. Big Bagel
    Member
    Posted 2 years ago #

    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 */
    }

Topic Closed

This topic has been closed to new replies.

About this Topic