Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-05-27 13:47:38

pketh
Member
Registered: 2005-05-30
Posts: 24

differentiating posts that are less than a week old

Hey all,

I was wondering how (if?) it was possible to have my posts that were less than a week old automatically have a little image beside their title (like a little ‘new post’ badge or anything else). Is there a way to make a time sensitive form or tags in the default form (the latter is preferred) ?

thanks so much :)


personal site:
www.pketh.com

Offline

#2 2007-05-27 13:58:07

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: differentiating posts that are less than a week old

In your article form at the position where you want the image to appear:

<txp:php>
  global $thisarticle;
  if (time() - $thisarticle['posted'] < 7*24*3600)
  {
    echo '<img src="path/to/new.jpg">';
  }
</txp:php>

Last edited by ruud (2007-05-27 13:59:20)

Offline

#3 2007-05-27 13:59:59

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: differentiating posts that are less than a week old

Would csb_if_newer_than help you?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2007-05-27 14:04:00

pketh
Member
Registered: 2005-05-30
Posts: 24

Re: differentiating posts that are less than a week old

very very awesome!

I’ll try them both soon then

thanks again :)


personal site:
www.pketh.com

Offline

#5 2007-05-27 14:55:10

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: differentiating posts that are less than a week old

Try these ras_if_dates

Offline

#6 2007-05-27 15:04:25

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: differentiating posts that are less than a week old

Tks ruud,

As always : very short code for great fonctionnality!
Less n’d less plugin, more n’d more PHP!

Cheers,


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

Board footer

Powered by FluxBB