[resolved] how to know if excerpt on search page is page or post? (3 posts)

  1. forgetcolor
    Posted 5 years ago #

    in loop.php, how can i test whether the current post being worked on is a Page or a Post? when on a search or tag results page, i want to show post dates only if the result is a Post, but not if it's a Page.

    i've tried is_page() and $wp_query->is_page but can't get it.


  2. Michael
    Forum Moderator
    Posted 5 years ago #

    $posttype = $post->post_type;
    if($posttype == 'post') { the_time(); }
  3. forgetcolor
    Posted 5 years ago #

    aaawwwesome, thx!

Topic Closed

This topic has been closed to new replies.

About this Topic