scriptygoddess RSS Feed
 
 
 
 

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

(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. 1
    Sillybean:
    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…

  2. 2
    Sillybean:
    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…

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

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

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

  6. 6
    vladsi:
    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…

  7. 7
    As deep as a puddle after a hard rain:
    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…

  8. 8
    The Lost Olive:
    MT – Cool Scripty…..
    scriptygoddess…

  9. 9
    The Realm of Chadness:
    This Is A Test
    This is a test to try out this code that I found on Scriptygoddess via this post at the Movable

  10. 10
    Sillybean:
    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

  11. 11
    mike.whybark.com:
    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 -…

  12. 12
    Elemental Analysis:
    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

  13. 13
    The Trommetter Times:
    Back to the Future
    Ever wanted to be able to post in the future? It may not be possible to do exactly that, but

  14. 14
    Ronald:

    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?

  15. 15
    Jennifer:

    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.

  16. 16
    Hoochie Coochie Man:

    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?

  17. 17
    Jennifer:

    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)

  18. 18
    Jenna:

    excellent script.. thanks!

  19. 19
    The Bartender:

    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.

  20. 20
    sam:

    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!

  21. 21
    sam:

    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

  22. 22
    sean:

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

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

  23. 23
    Jai:

    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.

  24. 24
    Mike:

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

  25. 25
    Jai:

    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.

  26. 26
    Mike:

    Jai,
    Another ASP person here, I'm trying to use your code, but I'm getting :
    Error Type:
    Microsoft VBScript compilation (0×800A0400)
    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?

  27. 27
    Jai:

    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 ;)

  28. 28
    Erik:

    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 ?

  29. 29
    Erik:

    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 ?

  30. 30
    Todd:

    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

  31. 31
    kjmck:

    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?

  32. 32
    Jennifer:

    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. :)

  33. 33
    Anonymous:

    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

  34. 34
    Jennifer:

    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…

  35. 35
    Geraldine:

    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?

  36. 36
    Jennifer:

    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…

  37. 37
    Dania:

    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?

  38. 38
    cricket:

    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.

  39. 39
    Esquart:

    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.

  40. 40
    girlie:

    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? =)

  41. 41
    Jason:

    If you're having problems getting your server to process the code as PHP then your server might also be looking for ASP. Then the server sees <? it could be ASP code or PHP code. To prevent your server from getting confused, always start your code with <?php

  42. 42
    Jason:

    Anybody know how to prevent future-dated posts from showing up in your RSS feed?

  43. 43
    Jason:

    I don't think your trackback counter is working correctly. It shows 0 trackbacks, but I pinged your site last night when I made a future posted entry.

  44. 44
    Jason:

    Ah, now you're showing 1 trackback. I guess it doesn't show unless the page gets rebuilt.

  45. 45
    meryl:

    This is a very cool script. Wish I had found it long ago… only thing is I can't use it in my main blog because I never had the time to convert it to php. Has anyone seen a similar solution that doesn't use PHP?

  46. 46
    Sid:

    I did something wrong. My last two posts are pre-posts and they aren't showing up on my main page. you have to view them through the recent entries.

  47. 47
    Mike:

    Thanks, I'm afraid I don't have the knowledge to get hold of the timestamps, and I wasn't aware of the difference. This is an area where I don't know much about coding so I'll have to leave it to the experts who are so far doing a wonderful job.

  48. 48
    Jennifer:

    Since the script only relies on the MTDate tag – it should still work – (that tag should be the same in the new version)

    I think the problem with the other code relates to trying to correct the timezone difference (if your server is in a different timezone than you)…

    As far as I know, there's a limited number of "variables" you can put in for the strtotime function… "-3 hours" isn't valid. You might try getting the unix timestamp of the entry, the unix timestamp of the server. Get the difference, and if it's greater than (unix timestamp) 3 hours – don't display… If I have time to "play" later I'll try to figure it out.

  49. 49
    Johanka:

    Could it be possible that the script stops working when you switch to the newest version, 2.5, of MT? Because this is the thing that seems to happen to me.
    (I should have asked in the support forums, I know…)

  50. 50
    Mike:

    I'm afraid I can't answer that one, despite upgrading to MT2.5. After posting that the script worked fine, it then turned out that it wasn't working fine at all, so I had to remove it.

  51. 51
    Mike:

    I've got some bad news for you Kristine, that one wouldn't work either. This one pretty much works the same as the first code, except that if you set certain numbers for the hour difference, entries will pretty much randomly vanish.

  52. 52
    Mike:

    I have good news, it suddenly struck me to change the time to +6 hours. Originally I'd tried +5, then I remembered American timezones go from 5 hours behind us to 8 hours behind us. +5 hours hid the entry I'd just posted, so I did +6, and the entry appeared. I then set an entry to appear in 3 hours time, and it hasn't shown up on the main page, so I think I may have fixed it.

  53. 53
    Jody:

    Okay, I'm a big dummy. I'm also getting the "strtotime ("September 11, 2002 12:00 AM")) { ?>" error like Michael. I just can't figure out how to fix it.

    Argh

  54. 54
    kristine:

    Okay, this is revised from my post this afternoon – its definitely more likely to work :)

    <?
    $time = date("F d, Y h:i A", strtotime("-3 hours"));
    $mttime = date("F d, Y h:i A", strtotime("<$MTEntryDate format="%B %d, %Y %I:%M %p"$>"));
    if ($time > $mttime)
    {
    ?>

    That's just the top red part, make sure you use the whole script with the end red part with this! :)

    For those of you who are seeing the same error that Michael did initially, you might double check that you are using this on a page with an extension of .php – that makes a difference, and if you are actually seeing the code, it is very possible that you don't have php working.

  55. 55
    Mike:

    Okay, I got it

    <?
    if (time() > strtotime ("

  56. 56
    Mike:

    Okay, well, tried it out, adding +5 as I figured the site's server being behind must be American (there's nothing between here and there)…unfortunately it just does away with every entry, even the ones 10 days old

  57. 57
    Mike:

    Thank you Kristine, it's great that you took the time out to work on this for us :-) I haven't tested it yet, I'll give it a try

  58. 58
    kristine:

    This is untested – just written up with the php.net manual in front of me and MT's manual to compare the date tags, as well as my info from the other thread I posted about time.

    For people with time zone issues, you could try replacing the red top code with this:

    <?
    $time = date("F d, Y h:i A", strtotime("-3 hours"));
    $mttime = strtotime("<$MTEntryDate format="%B %d, %Y %I:%M %p"$>");
    if ($time > $mttime)
    {
    ?>

    You can adjust the -3 hours to whatever amount of adjustment you need. For me, my server is in Tampa, and I'm on the west coast, so that's the amount of offset I need for another script.

  59. 59
    Michael:

    Thanks Jennifer, that fixed it perfectly. Unfortunately it seems my server is in a different timezone (not sure which) and so both of today's entries have just vanished…ah well

  60. 60
    Jennifer:

    If you didn't do anything special to make your html page process like php… my guess is it's not… there's insructions (or at least a LINK to instructions) on how to do that… do a search… it'd be an entry in your htacess file…

  61. 61
    Michael:

    You may have put your finger on it with the php suggestion, because I've double checked my code and I put it in exactly as you have it. Just a cut and paste job into the right spots.

  62. 62
    Jennifer:

    The time zone problem… I think you'd have to figure out the difference between your time and the server time and add/subtract appropriately…

    As for the errors – folks, I know this script works, I've had several people test it and are using it without problem. Please check your code. (Or post your problem and perhaps people can help)

  63. 63
    Michael:

    Looks like I'm also getting

    strtotime ("September 18, 2002 09:48 AM")) { ?>

    in the resulting page. Too bad because this would be an excellent script. Anyone know the cure for this?

  64. 64
    Fred Alan:

    Would have been nice, but I too receive the error of

    strtotime ("September 11, 2002 12:00 AM")) { ?>

    in the resulting page.

  65. 65
    Tiziano:

    Why I am getting a "-1" as result of the strtotime function?

  66. 66
    Fred Alan:

    Would have been nice, but I too receive the error of

    strtotime ("September 11, 2002 12:00 AM")) { ?>

    in the resulting page.

  67. 67
    Johanka:

    Time zone related problem here.
    I'm located in Europe while the server is located in America. So that when I pasted the script into my index template, it even hid the post that was supposed to be there already! Is there any workaround for this issue?

  68. 68
    Rick:

    i have a problem when i post your code. when i rebuild my page it shows "strtotime (september 2, 2002 2:34)". maybe the problems is that i use the dutch version of date notation? maybe something else? please help and keep up the good work!

  69. 69
    Jennifer:

    Kymberlie – I just tested that out to be sure… and that wasn't happening to me… perhaps there's some other code in there that's conflicting with it?

    If you do one post – date it for the future… then do another post, and it's dated for the present… even if you look at your "edit entries" list, you'll see it orders it by date…so there's no reason why your "prepost" should also show up.

    The one thing that I *did* notice is that if there's a "future" post for the same day as a "current" post, the "date header" won't show up until the future post is set to be seen.

    You could just put the code below the date header, but then the date header will show up even if you only have ONE post and it's not supposed to be seen yet…

  70. 70
    Kymberlie R. McGuire:

    Okay, after messing around with it, I've discovered that if I post another post, the hidden one shows up too – and it's an hour before it's supposed to! Anyone else running into this?

  71. 71
    Kymberlie R. McGuire:

    Just noticed something: if you have the "hidden" post it makes the date header go away on my site. In other words, if it's at the top, I don't get a date for the day displayed. This is my code, if you're curious:

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

    <br> 
    <MTDateHeader>
    <div class="dateheader"><H1><b><$MTEntryDate format="%A, %B %e, %Y"$></b></H1></DIV>
    </MTDateHeader>

    <DIV class="content">
    <a name="<$MTEntryID pad="1"$>"></a>
    <div class="titlefont"><$MTEntryTitle$><br /></div>

    <$MTEntryBody$>

  72. 72
    Kymberlie R. McGuire:

    For some strange reason, it appears to be working now. I think it was having a problem with the time I was putting in; if I put a post to show up in like fifteen minutes, it didn't want to work but if I did it to show up in an hour or more it worked (well, they hadn't shown up yet and the "Come back later" was received if trying to hit it through the individual entry page). Thanks again for another kick-ass code!

  73. 73
    Jennifer:

    PS – for those of you that are subscribing to this post/comments… I updated the comment about the individual entries "you're too early" code, and the main post itself… Too much going on when I edited the post the first time… So there was some redundant stuff in there… duh. All better now. :)

    It's also even more compact than before! (Kinda funny when you think about all the work I did originally to get this to work, and now it's essentially ONE LINE!) :-B duh!

  74. 74
    Donna:

    Jenn – that was just the explanation I needed; it's working beautifully! Thank you.

    As an FYI to anyone who's curious – even though the post does not show up when you "publish", you will ping weblogs.com and the MT site (if you have a registration key) when you change the status to "publish" and the post is pending.

  75. 75
    Jennifer:

    Kymberlie – one thought… without seeing your code it's hard to guess what's happening… but make sure you have the code in the right place… ALL the code is going INSIDE the MTEntries tags now… if you have some of it OUTSIDE, it will probably not work…

  76. 76
    Jennifer:

    Donna – Yes, sorry… should have been more clear… You should follow the instructions almost exactly as I said in the original post… with these few exceptions…

    1) obviously, on the individual entries archive, there is no MTEntries tag… so just put the code before where your post is (I'd suggest putting it after the "next/previous" code but BEFORE the date header stuff…

    2) at the end… where you're supposed to put those three little lines <? } ?> … instead of those three lines put that other snippet… where you have the "You're too early" etc.

    Here's a sample: (some non-relevant code was removed)
    <p>
    <MTEntryPrevious>
    <a href="<$MTEntryLink$>">« <$MTEntryTitle$></a> |
    </MTEntryPrevious>
    <a href="<$MTBlogURL$>">Main</a>
    <MTEntryNext>
    | <a href="<$MTEntryLink$>"><$MTEntryTitle$> »</a>
    </MTEntryNext>
    </p>

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

    <h2><$MTEntryDate format="%B %d, %Y"$></h2>

    <h1><$MTEntryTitle$></h1>
    <p><i><$MTEntryDate format="%I:%M %p"$></i></p>
    <$MTEntryBody$>

    <a name="more"></a>
    <$MTEntryMore$>

    etc. etc. etc. etc….

    </MTEntryIfAllowComments>

    <?
    } else {
    ?>
    <p>you're too early! Come back at <$MTEntryDate format="%B %e, %Y %I:%M %p"$> to see this post.</>
    <? } ?>

    (fyi – I updated this comment so that it has the "silly/stupid" extra code removed as well…)

  77. 77
    Kymberlie R. McGuire:

    Grrrr. I thought I had deleted everything, but it's still not working right for some reason. I'll have to see if I can't figure it out later.

  78. 78
    Donna:

    Okay, I'm set to post just a few minutes from now – woohoo! Multi-tasking at its finest.

    Jennifer, because I'm not understanding it correctly, and I imangine others might need clarification, could you please explain how the "you're too early" code should be implemented? When I installed just that snippet in the standard MT individual entries template, I got a parse error – should I install both "halves" (the "show later" half and the "you're too early" half) of the code in my individual entries template? I also tried replacing the little end code string in the main index template with the "you're too early" code, and it showed up on the page.

    Almost there…thank you!

  79. 79
    Jennifer:

    Donna – yes. It's a WHOLE lot simpler now.

    Kymberlie – I tested it out and I know it works. I'd suggest removing the old code completely and "starting from scratch" with it… perhaps there's a piece that wasn't getting commented out…

  80. 80
    Donna:

    Okay, it looks like this revised, simplified version no longer needs to go in a header or footer include on every page; you just alter your template, and you're good to go – true? If so, wow.

  81. 81
    Kymberlie R. McGuire:

    I tried replacing the old script with the new script and commenting out the month function part that was supposed to go in the header and now it seems like it's not working.

  82. 82
    Jennifer:

    PapaScott – Excellent!! It works! Thanks for the tip! I'm going to update the script in the post. Nice job!

  83. 83
    Jennifer:

    if anyone can figure out how to control it on the mt calendar or the next/previous entry… let me know. I can't at the moment.

    The only thing I can think of for how to "hide" the post is to do something like this on the individual entries template:

    at the bottom… where I have just this:
    <?
    }
    ?>

    change that to this:

    <? } else { ?>
    <p>you're too early! Come back at <$MTEntryDate format="%B %e, %Y %I:%M %p"$> to see this post.</p>
    <? } ?>

  84. 84
    Kymberlie R. McGuire:

    Btw, my post showed up at midnight, just like magic. :-)

  85. 85
    PapaScott:

    It looks like I forgot to put the MT tag in quotes, since the argumnet to strtotime needs to be a string. (Hey, I did cover myself by saying 'something like' :-) So that line should read

    if (time() > strtotime ('<$MTEntryDate format="%B %e %Y"$>'))

    Both functions do return the number of seconds since Unix was born, so the result can be compared directly.

    echo time(): => 1028351148
    echo strtotime('July 31, 2002'); =>1028066400

  86. 86
    Donna:

    Oh my gosh, you've found the Holy Grail of blogging :) Now all I have to do is start using header and footer includes, and I'm set!

  87. 87
    Jennifer:

    PapaScott – I just tried your code snippet out but didn't get it to work. Were you able to get that to work?
    PHP.net has the definition of time() as follows:
    Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

    Which isn't the same thing as what you get when you do strtotime()… as far as I know… or maybe I'm doing it wrong…??

  88. 88
    PapaScott:

    Check out the php function strtotime. The whole routine to check the current time could probably be shortened to something like this:

    $displaypost = false;
    if (time() > strtotime (<$MTEntryDate format="%B %e %Y"$>))
    {
    $displaypost = true;
    }

  89. 89
    Kymberlie R. McGuire:

    Very cool! I've got one set to show up tomorrow so if it does, we know it's working.

    Future development idea: is there any way to do it so that you could set a post to show up in an hour on the same day and it work? Say, if I want to make a post at work but I want it to look like I did it after hours instead? ;-)

  90. 90
    Kymberlie R. McGuire:

    I just noticed that if you have a calendar where the user can click the date to see the entries, they can see the entries that technically haven't posted yet. Is there a way to hide them on the calendar (you can see what I'm talking about at my site)?

  91. 91
    TripleX:

    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…

Categories

Archives

Bookmarks

WordPress Resources

Meta

ADVERTISEMENTS