You must be logged in to post Login Register


Register? | Lost Your Password?

Search Forums:


 






Minimum search word length is 3 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 1042

Hi Simon,

Thanks for your contribution !

Jean-Luc


About the InternetOfficer.com Forum

Forum Timezone: UTC 1

Most Users Ever Online: 201

Currently Online: Diggy
14 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 2
Forums: 9
Topics: 497
Posts: 2378

Membership:

There are 2048 Members
There have been 245 Guests

There is 1 Admin
There is 1 Moderator

Top Posters:

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

Recent New Members: Diggy, mopl91, henrique, ScottWigle, mgshirinda, andersondj

Administrators: Jean-Luc (1042 Posts)

Moderators: Jean-Luc (1042 Posts)