You must be logged in to post Login

Lost Your Password?

Search Forums:


Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

Identifying posts or pages in Loop


5:14 am
February 7, 2008



The plugin is working perfectly for me, but there's a bit of an issue regarding dates.

On WordPress posts, it makes sense to show the date of creation. On pages, which are typically more static but may need to be updated, the 'last modified' date makes more sense.

Is there an easy way I can detect which results are posts, and which are pages? Then I could do a simple 'if', to decide which date to show. 

6:02 am
February 7, 2008



Think I've answered my own question… if you add the following into your (index.php) page's Loop, you get a straightforward 'if' situation.


$type = $post->post_type;

if ($type=='post') { -this- } else { -that- }


7:09 am
February 7, 2008



posts 1125

Hi Simon,

Thanks for your contribution !


About the Forum

Forum Timezone: UTC 1

Most Users Ever Online: 302

Currently Online:
13 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 2
Forums: 9
Topics: 639
Posts: 2710


There are 257 Members
There have been 304 Guests

There is 1 Admin
There is 1 Moderator

Top Posters:

cssfsu – 55
deepakgupta – 34
albert_newton – 30
cosminpana – 20
DTNMike – 19
ahtshun83 – 17

Recent New Members: raju, todd2taylor, sbdcunha, mansigill1987, ThomasDuh, ThomasKic

Administrators: Jean-Luc (1125 Posts)

Moderators: Jean-Luc (1125 Posts)