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

UserPost

5:14 am
February 7, 2008


Simon

Guest

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


Simon

Guest

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.

<?php

$type = $post->post_type;

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

?> 

7:09 am
February 7, 2008


Jean-Luc

Admin

posts 1125

Hi Simon,

Thanks for your contribution !

Jean-Luc


About the InternetOfficer.com Forum

Forum Timezone: UTC 1

Most Users Ever Online: 302

Currently Online:
10 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 2
Forums: 9
Topics: 638
Posts: 2712

Membership:

There are 257 Members
There have been 305 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)