Skip Navigation

[Resolved] Display the name of the Custom Post Type in search results

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Toronto (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by joshM-4 7 years, 1 month ago.

Assisted by: Meagan Hanes.

Author
Posts
#486699
Screen Shot 2017-02-07 at 9.06.06 AM.png
Screen Shot 2017-02-07 at 9.05.02 AM.png

I am trying to: determine how to use a conditional statement in the search results archive so that each result shows the name of the custom post type it came from. For example, if a result is from the "Testimonial" post type, I'd like to be able to have the result display "Testimonial" in the search results. Same for my other custom post types as well as regular posts (and even pages if possible).

I visited this URL: hidden link

I expected to see: see description above

Instead, I got: see description above

#486735

Hi Josh! Thanks for your question about how to add the post type to your View.

I'm happy to say this is done easily using the wpv-post-type shortcode. More information on this can be found here: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-type

In your Loop Editor, click the Fields and Views button, and select the Post Type option. You can choose how you want it to be displayed - I suggest choosing the second option, Post type singular name.

The following shortcode will be created: [wpv-post-type show='single']. Simply place this in the desired location and style with CSS as needed.

Hope this helps!
Meagan

#486790

That is fantastic. It was right in front of me but I somehow missed it! Thanks for the help!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.