Differentiate between posts and pages in search results

How can one differentiate between posts and pages in search results?

What I need to do is show a the_time div for posts but not show it for pages, as it’s irrelevant.

Read More

With a function? <?php if (!is_page()) } in the loop below doesn’t help.

<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>

//prevent this div from displaying for pages: 
<div class="searchdate"><?php the_time('F jS, Y') ?></div>

<?php the_excerpt(); ?>

<?php endwhile; ?><?php else : ?><?php endif; ?>

Related posts

Leave a Reply

1 comment