• I have created a few custom post types with custom fields (ACF) to keep my content very organized. In my template I use WP_Query to populate page segments pulled from the CTP and ACF. I was asked to include a search box but what I have discovered it the content display on screen via the WO_Query is not searched. My search results include only the CPT posts.

    How do I get my search results to display the rendered page whose template uses the wp_query to populate the content of the page.

    Thank You

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Your theme’s search.php (or index.php if lacking search.php) template is responsible for rendering raw search results in a presentable manner. You could include other template parts as part of this if need be.

    The search.php template is used for any search query, rendering regular posts like you would for your CPT is probably inappropriate. Thus you probably need a conditional that says basically “if the current post is my CPT, include the related template part, otherwise do the normal post output.”

Viewing 1 replies (of 1 total)
  • The topic ‘search results from wp_query content’ is closed to new replies.