Publish only entries with dates the future or past

| No Comments

This code should display entries with publish date of today or in the future… didn’t test it though, just posting it here for future reference.

<$mt:Date format="%Y%m%d" setvar="today"$>
   <$mt:EntryDate format="%Y%m%d" setvar="entry_date"$>
   <mt:If name="today" lte="$entry_date" >
       <p><a href="<$mt:EntryLink$>"><$mt:EntryTitle$></a><br/><$mt:EntryDate$></p>

Note: because MT publishes static files, “today” is the date that the template is published. Bob the Rebuilder or other similar plugins can trigger rebuilds to ensure this content is fresh daily. Otherwise it may be wise to use a scripting language (php, js, etc) to hide non-desired content.

Change “lte” to “gte” and then the script will display entries with dates before today.

Leave a comment