Identifying posts or pages in Loop


 

Current User: Guest Login Register
Please consider registering

Search 
Search Forums:


 




Identifying posts or pages in Loop

Add a New Topic Reply to Post
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 220

Hi Simon,

Thanks for your contribution !

Jean-Luc

Add a New Topic Reply to Post


Reply to Topic: Identifying posts or pages in Loop

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 12 + 2        (Required)

Topic Reply:


 

WebStats1


About the InternetOfficer.com forum

Currently Online:

4 Guests

Maximum Online: 20

Forums:

Groups: 2

Forums: 7

Topics: 103

Posts: 492

Members:

There are 25 members

There are 94 guests


Jean-Luc has made 220 posts

Top Posters:

Steve - 14

angelko - 4

cwei - 4

Kinglui - 3

vtroymck - 3

Administrator: Jean-Luc | Moderators: Jean-Luc


© Simple:Press Forum - Version 3.1.2 (Build 340)