How do I create different templates for search results than for single-post pages

I want to use CustomPress to create real estate listings... I want a "search" to list results in a loop, showing aan abbreviated layout for each, and I want the single pages to display expanded info (multiple, additional custom fields, and so forth)... how do I do that?

  • PC
    • WPMU DEV Initiate

    Hey there nik,

    Thanks for your post.

    It seems you are looking to create a search template which shows the results and just a little bit of info on that and when clicked, they take on a single page template with more information on the same ?

    You should start here : for the search page however I am not sure on what would be the best way to show an abbreviated layout.

    Let me call our lead developer for his feedback on the same.

    Cheers, PC

  • Arnold
    • El Macho WP

    If you take a look at the Template Heirarchy of Wordpress

    You can see how the various types of pages may be named. For things like single or Archive pages you can append the name of the custom type toselect a different template when that custom post type is being displayed.

    Unfortunately this doesn't work for Searches because searches may end up mixing post types, so it hardly pays to make diferent ones for different types.

    You can create a search.php template and add conditional statements to change the display based on the current post type.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.