WordPress.org

Support

Support » How-To and Troubleshooting » Telling the difference between a page and a post inside search.php

Telling the difference between a page and a post inside search.php

  • I’ve pasted the code in question below (cutting out unnecessary stuff).

    My question is, how, just before <div class=”p-det”> can I determine whether the individual search result I’m outputting is a post or a page. I don’t want to list categories or comments for pages but I do for posts …

    Any help much appreciated 🙂

    m.

    –>

    ‘<?php while (have_posts()) : the_post(); ?>

    <div class=”p-det”>

      <li class=”p-cat”>In: <?php the_category(‘ |’) ?>
      <li class=”p-com”><?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?>

    </div>

    <?php endwhile; ?>’

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Telling the difference between a page and a post inside search.php’ is closed to new replies.