• Hi,

    Im my search results page I would like to use a different layout when a page is found and when a post is found. The list of searchresults returns pages and posts. I want to check wether its a page of a post, so I can use different layouts.

    Now I have:

    <?php if ( is_page() ) { ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">Page: <?php the_title(); ?></a><br><?php the_excerpt(); ?>
     <?php } else { ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> | <?php the_time('j F Y'); ?><br><?php the_excerpt(); ?>
     <?php } ?>

    The function is page checks if the current page/post is a page is a post. But how check I check this for search results? I thought about get_type_post. Please help?

    Sugar

  • The topic ‘Different layout for posts/pages in search results’ is closed to new replies.