default userpic

Only select future posts

Vote 0 Votes

I am building an event-section and need only to publish the future events. Any clue on how to accomplish this?

Something in the likes of

Best regards

Reported on Movable Type 4.3

12 Replies

| Add a Reply
  • I'd just give them a tage like "Future" and select them as usual. Then you can just remove the tag as it passes.

  • Thanks for the suggestion, it is a useful one, but not in practice. Especially not if a lot of events are added everyday.

  • This should work but appears to be evaluating the length of the strings instead of the value of the numbers created by formatting the dates; since all posts show up when you use lt="thecurrentdate" and none show up when you use gt="thecurrentdate", but the dates output as expected...

    Let me know if you figure out the answer! Very interested! ^_^


    Upcoming Events as of <mt:entries><$mt:Date format="%Y%m%d" $><br/>

    <mt:setvarblock name="theentrydate"><$mt:EntryDate format="%Y%m%d" $></mt:setvarblock>
    <mt:setvarblock name="thecurrentdate"><$mt:Date format="%Y%m%d" $></mt:setvarblock>
    <$mt:Var name="theentrydate"$> -EntryDates vs. CurrentDate- <$mt:Var name="thecurrentdate"$>
    <mt:if name="theentrydate" gt="thecurrentdate" >
    <$mt:entrydate$><$mt:entrytitle$><br/>
    </mt:if>
    </mt:entries>

  • oops, forgot you need to include the trim and strip_linefeeds as follows:

     
    <mt:date format=ā€%Y%m%dā€ strip_linefeeds="1" trim="1">

  • That's actually a real clever suggestion. Am gonna try it. Tnx!

  • hm, the only problem is you never know how many entries you'll get. Something like is useless in this case. Guess I'll have to hack it myself to find out to create a modifier like future="1" or something.

  • But thanks!

  • I tried to write 'something like <mt:entries limit="10"/>', but mt stripped my tag

  • usually you use limit with sort by an lastn without sort by:

    
    

    <mt:Entries limit="10" sort_by="authored_on" sort_order="ascend">
    or
    <mt:Entries lastn="10">

    (which will pull most recent entries, not sure if it's by publish date or the editable authored_on date)


    ^_^

  • True, but still: you wouldn't know how many of those last 10 will meet the criteria of being in the future. It might be none, or it might be 10, or it might be a value in between. So if you want to have at least 10 items on your page, this way it's not gonna work...

    Also: if you want to display 10 items on your page and you have 20 items in the future and you sort on date, then you will miss the first 10 items in the future...

    It was a real clever idea, but not sufficient for what I need :)

  • I want to do something similar and the old DateTags from Staggernation aren't working for me. So I found that Beau Smith published this snippet on his site:

    http://www.beausmith.com/mt/2009/05/publish-only-entries-with-dates-the-future-or-past.php

    But when I add 'category="categoryname" ' to the mt:Entries tag, it breaks it completely and shows all entries. Any ideas why?

  • I found a little bug in the 'days' attribute of mt:entries that makes it possible to easily select only future entries:

    http://www.movabletips.com/2011/02/how-to-publish-only-future-entries-in-movable-type.html

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1773 6162

Last Topic: Excluding categories from blog by kholechek on Feb 9, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1429 5077

Last Topic: What apocalypse hit this community in the middle of 2011? by 75th on Feb 10, 2012

695 2910

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

173 737

Last Topic: About the MT version stated in HTML source by Alex E. Schneider on Feb 7, 2012

190 567

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012