Display Search Results for custom post type
-
Hello,
Thanks for this awesome plugin!Wondering how I would go about customizing the way that my search results are displayed. I added the code snippet from your website to my functions.php file, but no matter what I searched for it said “no results found.” So I would appreciate some extra pointers.
I would like to display the results from a custom post type (“property”) with a thumbnail, title, and custom field data, if that data is present (i.e. Address, Lot Size, etc.).
How would I call that information in the functions.php file?
On the archive page, this is the way I have it set up:<h2 class="entry-title"><?php the_title(); ?></h2> <div class="one_third"><?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large'); echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" rel="prettyPhoto" >'; echo get_the_post_thumbnail($post->ID, 'medium'); echo '</a>'; } ?></div> <div class="two_third last"> <?php echo "Address: ".types_render_field("address", array("output"=>"HTML"));?><br/> <?php echo "Park Location: ".types_render_field("park-location", array("output"=>"HTML"));?><br/> <?php echo "Allowable Uses: ".types_render_field("allowable-uses", array("output"=>"HTML"));?><br/> <?php echo "Property Size: ".types_render_field("total-size", array("output"=>"HTML"));?> sq. ft.<br/> <?php echo "Max Ceiling Height: ".types_render_field("max-ceiling-height", array("output"=>"HTML"));?> ft.<br/> <?php echo '<a class="button small default" href="'. types_render_field("pdf-summary", array("output"=>"HTML")) . '" target="_blank" >'; echo "Download PDF Summary"; echo '</a>';?><br/></div>
How could I achieve the same layout for the search results?
Thank you so much for any tips you could offer…
I am an absolute newbie when it comes to php!https://www.ads-software.com/plugins/ajax-wp-query-search-filter/
- The topic ‘Display Search Results for custom post type’ is closed to new replies.