scriptygoddess

02 Aug, 2002

Pre-post, but only have it show up when it's a "current" entry.

Posted by: Jennifer In: Scripts

(This script was originally written for Promoguy) The idea here is that you "pre-date" an entry. In Promo's case, he wanted to be able to write up his Monday Mission the day before, but not have it show up on his blog until it was actually Monday. Here's what you do:

Update 8/3/2002: (I've updated the script to a MUCH SIMPLER version thanks to PapaScott! It'll also let you control when the post shows up to the MINUTE!)

update 8/5/02: I've simplified the code further… I had some silly/stupid stuff in there before…

Step one:
"Install" the script below. (wanted to give you the instructions first, before I threw a bunch of code at you… so skip ahead to the code to do the installation…)

Step two:
Write your post, but save it as a draft.

Step three:
Once saved, you can edit the "date" of the post. Change the date to whatever day you want your post to actually show up.

Step four:
This time you save it, with "publish" as the Post Status instead.

That's it. It won't show up on your blog, until it's the date you set. (heh. I hope. Once again, only minimal testing has been done on this script… so, as always, use at your own risk) :)

NOW the code… There's alot of code (update: actually now there's ALOT less since I've updated it!), but no customization… you just need to copy and paste it in the right spot to get it to work… So, it's not as scary as it looks… ok? I promise. :) (the code below is shown as an example of what goes on the index template… additional code will probably be required if you use individual entries and you don't want to have it show the "next" entry (until it's the right time) on the previous post.) I'll put it on my "to-do" list, which just gets longer and longer…

After your <MTEntries> tag, put the code as you see it below (I included the MTEntries tag, just for reference…) (please see commented notes below for what goes where). The code you need to paste is in red (the "existing tags" are in black)

<MTEntries>
<?
if (time() > strtotime ("<$MTEntryDate format="%B %e, %Y %I:%M %p"$>"))
{
?>

<!– PUT THE REST OF YOUR MT TAGS FOR YOUR POST BELOW –>
<MTDateHeader>
<h2><$MTEntryDate format="%B %d, %Y"$></h2>
</MTDateHeader>

<a name="<$MTEntryID pad="1"$>"></a>
<h1><$MTEntryTitle$></h1>
<p><i><$MTEntryDate format="%I:%M %p"$></i></p>

<$MTEntryBody$>

<MTEntryIfExtended>
<p><a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>">MORE…</a></p>
</MTEntryIfExtended>

<p align="right"><a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>">permalink</a>
<MTEntryIfAllowComments> | <a href="<$MTEntryLink$>#comments">
<$MTEntryCommentCount$> comments
</p>
</MTEntryIfAllowComments>
</p>
<br>
<!— END OF ALL YOUR MT TAGS FOR YOUR ENTRY –>
<!– Make sure you add the next little lines below BEFORE your put your "/MTEntries" tag. –>

<? } ?>

</MTEntries>

Let me know if you run into any problems, so I can try to fix the script.

91 Responses to "Pre-post, but only have it show up when it's a "current" entry."

1 | Jennifer

November 8th, 2002 at 3:57 pm

Avatar

Unfortunately – there probably isn't (at least not with this script). The script isn't really not posting the entry – it's just hiding it depending on the day the page is displayed. It still IS actually there… So it would show up in the RSS feed. :-\ Sorry…

2 | Geraldine

November 14th, 2002 at 4:03 pm

Avatar

I have tried this in Krisitine's Blogstyles Photoblog Tutorial/Templates

This includes

<MTEntries lastn="30">

The 'future post' works beautifully, except that it includes future posts in the 'n' of 'lastn'. This is disappointing, because I hoped that when I go away, I could set up future posts so that people could see new photos every day.

Is there anyway round that?

3 | Jennifer

November 14th, 2002 at 4:20 pm

Avatar

Ok, you lost me – you want to email me what your template looks like? The script shouldn't be dependent on any MT tag – except for the DATE tag. It compares the DATE of the POST to the CURRENT DATE (and time) (on the server). lastn="30" shouldn't make a difference, I would think…

4 | Dania

November 25th, 2002 at 11:42 pm

Avatar

Ok I implemented this today for my Two For Tuesday. Didn't get any pasrse errors or anything, but my post before it is missing, and I tried posting another one after the "future" post and that one doesn't show up…am I doing something wrong?

5 | cricket

December 8th, 2002 at 10:23 pm

Avatar

Try changing the strtotime("-3 hours to like +5 or -8 or something. And keep track of the exact hour of your old post and make sure your new post reflects it too for a better reference. It does work.

6 | Esquart

December 20th, 2002 at 1:48 pm

Avatar

Wow!

Future posting is indeed the Holy Grail of blogging:
I'm amazed a clean way to do it is not in 2.5.

Only one problem with your solution as far as I can see: future posts are searchable ;(

there goes the element of surprise (!)

any answers?

nice job nonetheless.

7 | girlie

January 23rd, 2003 at 11:22 pm

Avatar

Has anyone noticed that if you include this line in your code, that it means the final MTEntries tag doesn't get parsed?

<!– Make sure you add the next little lines below BEFORE your put your "</MTEntries>" tag. –>

I wasn't sure if anyone had already realized that MT is seeing that </MTEntries> as the closing tag (it didn't affect my test usage of the script, but I'd thought I'd throw it in here anyway).

But I did think it was interesting that, in the final result, that last bit of code isn't really being placed before the actual tag which MT sees as the closing tag (despite instructions to the contrary).

Maybe it doesn't really matter? =)

8 | Jennifer

January 24th, 2003 at 8:26 am

Avatar

Actually – that sort of makes sense – because those comment tags are only read by the browser… MT, when building the page doesn't care about that… it only understands *it's* tags…

I'll take it out of the code, so no one gets tripped up. :)

9 | Anonymous

March 27th, 2003 at 9:58 am

Avatar

hello,

when I publish this is what I geton top of my page:

strtotime ("March 28, 2003 03:50 PM")) { ?>
March 27, 2003
This is the news
news1 …

Continue reading "This is the news"

Posted by pierluigi at 03:50 PM | Comments (0)

any help ?

thanks
Josh

10 | Todd

May 18th, 2003 at 7:08 pm

Avatar

God bless you.

That's all I can say at this point, after struggling to find the tools I needed to make my calendar blogs work properly. This little bit o' PHP just makes it all sing.

You are an angel. Thanks,

Todd

11 | kjmck

June 18th, 2003 at 3:45 am

Avatar

The only place I could find the tag was bloghome/lib/MT/default-templates.pl.

Is that the file into which I should paste the code above?

12 | Erik

July 12th, 2003 at 11:09 am

Avatar

I'm using

With 8 predate postings only 2 entries will be shown. How can a change this MT to show the last 10 not predated postings ?

13 | Erik

July 12th, 2003 at 11:11 am

Avatar

Oeps…

I'm using <MTEntries lastn="10">

With 8 predate postings only 2 entries will be shown. How can a change this MT to show the last 10 not predated postings ?

14 | Jai

July 22nd, 2003 at 3:09 pm

Avatar

For anyone interested in an ASP version of this, I listed one below. Just replace the Scripty version's first red line (in the script above) with this:

<% adjdate = now()
adjdate = dateadd("h",-5,adjdate)
if (adjdate > cdate("<$MTEntryDate format="%B %e, %Y %I:%M %p"$>")) then
response.write
%>

[note the -5 is for me, since my server is 5 hours ahead of my timezone. this number can be adjusted positively or negatively based on where your server resides. I think it will accept a value of zero.]

then replace the second little line of the Scripty code ( the one that looks like this:

(<? } ?>)

with:

<%end if%>

Have fun with ASP now. I know we can't all be PHP people 😉

15 | Mike

July 24th, 2003 at 10:01 am

Avatar

Jai,
Another ASP person here, I'm trying to use your code, but I'm getting :
Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement

Here is what I'm using

<MTEntries sort_order="ascend" days="5">
<% adjdate = now()
adjdate = dateadd("h",-5,adjdate)
if (adjdate > cdate("<$MTEntryDate format="%B %e, %Y %I:%M %p"$>")) then response.write %>

<$MTEntryDate format="%B %d, %Y" | %I:%M %p"$><br />
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a><br />
<$MTEntryBody words="20"$><br />
<%end if%>
</MTEntries>

Any ideas?

16 | Jai

July 24th, 2003 at 12:56 pm

Avatar

Yeah, I know exaclty what that is (I think). You are using <%Option Explicit%>, aren't you? When you do that, it expects good code :p

What you could do is just remove <%Option Explicit%> – this won't stop your code from working. All this does is ensure you use 100% perfect ASP code. Also, it does give you better error management. without it, your errors will become generic (they won't tell you what line causes the error, but it looks like you don't get that anyway).

I hope that fixes it.

17 | Mike

July 24th, 2003 at 5:14 pm

Avatar

Nope sorry, I'm using the exact code above in a basic ASP file….

18 | Jai

July 24th, 2003 at 9:26 pm

Avatar

Got me, it works on my server. Could be a config issue. there is also the possibility that your server doesn't understand that the stuff after the first "%>" should be rendered as HTML. You could try doing response.write ("all your mt stuff in asp response.write format").

Maybe add the conditional else tag- like

else
response.write("")

Got me. It works for me. Matbe you should make the first Response.write happen on the next line (your original code has it on the same line as your "then" statement.)

I want it to work for you, so keep me posted.

19 | sean

October 13th, 2003 at 12:36 am

Avatar

For my particular situation I have found that MovableTypeTrickle works better. MovableTypeTrickle

Still great work, and I may use your code in other situations.

20 | sam

November 18th, 2003 at 10:09 am

Avatar

Hi, I'm trying to get this to work, and it seems to be close, but for some reason my site's popping out yesterday's posts instead of today's.
any ideas?
thanks

21 | sam

November 18th, 2003 at 10:30 am

Avatar

I'm taking this to the mt support forums, i think it may be more of an MT issue. thanks though, still a very impressive and cool script!

22 | Jenna

November 23rd, 2003 at 11:10 am

Avatar

excellent script.. thanks!

23 | The Bartender

December 4th, 2003 at 9:56 pm

Avatar

I saw someone else had this same problem but did not see any answer in the comments. I get this string at the top of each post now and they are posting when I save as published.

strtotime ("December 4, 2003 09:00 PM")) { ?>

I inserted the code as instructed and saved in draft mode. Then from the same page at the bottom changed the date and post status. What did I do wrong? I have a whole group of people over at Munuviana that are wanting to implement this code.

Thanks for any assistance you can give me / us.

24 | Jennifer

December 4th, 2003 at 10:02 pm

Avatar

The is a PHP script – you need to be running php on your page. (In most cases this means your page must have a .php extension – not .htm, or .html)

25 | Hoochie Coochie Man

January 3rd, 2004 at 3:49 pm

Avatar

It wasn't readily clear by the thread here, but can the code be applied to the date based and the category templates as well, besides the individual entry template?

26 | Jennifer

January 3rd, 2004 at 3:55 pm

Avatar

Anywhere you can get that $MTEntryDate tag to work – you can use the script… And in fact, you NEED to include it in every template to really "hide" it.

27 | Ronald

January 26th, 2004 at 2:18 pm

Avatar

Works great…as long as you use English as language for date display. But in my case I use Dutch and then the script won't work. Now I thought I could use the MT language tags (cz, dk, nl, en, fr, de, is, jp, it, no, pl, pt, si, es, fi, se. In my case nl.) to solve the problem, but I'm not sure where to place it. Any ideas?

28 | The Trommetter Times

November 6th, 2002 at 10:27 pm

Avatar

Back to the Future
Ever wanted to be able to post in the future? It may not be possible to do exactly that, but

29 | Elemental Analysis

December 8th, 2002 at 11:09 pm

Avatar

Pre-posting Entries Using Moveable Type
A lot of people have this issue, because we (as bloggers), get inspired and write a whole bunch down without

30 | mike.whybark.com

January 4th, 2003 at 5:28 pm

Avatar

Testing scheduled publication
test to see if I've enabled the scheduled publication feature. This feature is a php-based hack from scriptygoddess.com, found here. Theoretically, it allows the publisher to set an entry to a date/time, and it won't appear until that date and time -…

31 | Sillybean

January 20th, 2003 at 7:37 pm

Avatar

Using Movable Type as an events calendar
There are a couple of ways of using Movable Type to create a calendar of events. One is to display

32 | The Lost Olive

March 25th, 2003 at 9:55 pm

Avatar

MT – Cool Scripty…..
scriptygoddess…

33 | The Realm of Chadness

April 26th, 2003 at 11:08 pm

Avatar

This Is A Test
This is a test to try out this code that I found on Scriptygoddess via this post at the Movable

34 | As deep as a puddle after a hard rain

May 6th, 2003 at 1:10 am

Avatar

Vacations are for suckers
Why should people suffer the pain of not reading your bloggy goodness just cuz you have to take your slacker ass off on a vacation? Think of your audience people! Don't they deserver better? Speaking for myself, Why, yes, damn it, you bet your sweet bi…

35 | vladsi

September 16th, 2003 at 9:18 pm

Avatar

A Betting Man
So my wife and I make bets about little, petty things that are trivial to everyone but us. The betting mechanism has evolved as a way to allow us to resolve conflict without arguing in endless circles when simple agreement…

36 | Wortfeld

October 3rd, 2003 at 7:18 am

Avatar

Testing
Wenn anderswo hemmungslos testgemobloggt wird, kann ich hier ja mal kurz sehen, ob ich die Zeitverzögerung von Scriptygoddess richtig installiert habe….

37 | Wortfeld

October 5th, 2003 at 6:28 am

Avatar

Zukunftswärts!
Gibt es einen Weg, wie MT Beiträge in der Zukunft publiziert?

38 | Patrick Fu

December 3rd, 2003 at 11:26 pm

Avatar

Pre-Post script installed
Installed PrePost — a script from ScriptyGoddess that'll allow me to write a blog and have it publish on a…

39 | Sillybean

December 9th, 2003 at 11:47 am

Avatar

Using Movable Type as an events calendar
There are a couple of ways of using Movable Type to create a calendar of events. One is to display future events as text entries, replacing the traditional bloggish today-going-backwards posting order. The key to this is the fact that…

40 | Sillybean

March 18th, 2004 at 4:09 pm

Avatar

Using Movable Type as an events calendar
There are a couple of ways of using Movable Type to create a calendar of events. One is to display future events as text entries, replacing the traditional bloggish today-going-backwards posting order. The key to this is the fact that…

41 | TripleX

August 13th, 2004 at 5:24 am

Avatar

Excellent script. But how can a prevent the predated postings to be listed in the rss feeds? I hope anyone can help me with this, pleeeeaaase…

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements