I have a search page that when you enter a blank query, it shows posts and pages together. This isn't an issue, it's fine. However I'd like to remove some details like the date from the pages as it doesn't make much sense.
I'm using the is_page function but that doesn't seem to work and I have no idea why, I'm including all of the necessary information (or so I thought).
<?php while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_ID(); ?>"> <?php if ( is_page() ) : ?> <?php the_title(); ?> <?php else : ?> <?php the_title(); ?> <?php the_time("jS F Y"); ?> <?php foreach ( get_the_category() as $the_category ) : ?> <?php echo $the_category->cat_name; ?> <?php endforeach; ?> <?php endif; ?> </article> <?php endwhile; ?>
The is_page function in the WP Codex.