ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a channel entries loop where I am pulling data from multiple channels. These entries are then mixed together in the sort order they are returned in. With all but one channel I'd like to restrict it to not show future entries. However, I do need to show future entries for that one remaining channel. What are my options.

share|improve this question
My guess is you need a custom query for this. – Justin Kimbrell Dec 21 '12 at 5:39

how about

{exp:channel:entries channel="alpha|beta|gamma"}
    {if channel_short_name == 'blah'}
        show me
        {if entry_date > current_time}
            show me
share|improve this answer
I think you need to filter on the date first because in your example 'blah', which shouldn't show future entries will do, and the other channel will only show future entries, not all of them. – Tyssen Dec 21 '12 at 5:08

You can only do that kind of conditional retrieval by using a custom SQL query that does some checking of dates for you. Fortunately it's a pretty trivial query - only a little bit of logic required. Without knowing more about what your data looks like, etc, it's hard to provide more details information, but I'd suggest you run something like the (totally untested, probably broken, and and likely to corrupt your DB) SQL below through the Query Module.

  exp_channel_titles.entry_id AS id,
  exp_channel_titles.title AS title,
  exp_channel_titles.entry_date AS date_published
  ((exp_channels.channel_name = 'no_future_posts_channel_name_1' OR
    exp_channels.channel_name = 'no_future_posts_channel_name_2') AND
    exp_channel_titles.entry_date <= NOW()) OR
    exp_channel_titles.channel_name = 'future_posts_ok_channel_name'
  date_published DESC
share|improve this answer
This is the approach I am going to take. Your query is a good start. Thanks for the help. – caseyreid Dec 21 '12 at 22:08

You could maybe do this:

{if entry_date > current_time}
   {if channel_short_name == "channel-that-should-show-future-entries"}
      show stuff
   {if (channel_short_name == "channel-that-should-show-future-entries" && entry_date <= current_time) OR channel_short_name!="channel-that-should-show-future-entries"}
      show stuff
share|improve this answer
This assumes you've got show_future_entries="yes" on your channel entries tag. – Tyssen Dec 21 '12 at 5:08
Thanks Tyssen. The only issue with that approach I think is that I need to return a set number of entries. If I am showing/hiding entries inside the c:e loop, the count is not going to stay accurate. I think it's going to require a custom SQL query to grab the right entry ids and then feed those into the c:e loop. That is the path I'm heading down, but wanted to make sure I wasn't overlooking something first. – caseyreid Dec 21 '12 at 5:15
Ah right, yeah a fixed limit will throw that out. Query module should do it. – Tyssen Dec 21 '12 at 5:16

I think a custom query in a simple plugin would be the most straightforward approach. However, it may be possible using just a template without a custom query if you:

  1. Ran an entries loop that allowed future entries, ultimately returning more than you needed
  2. Added those entries you wanted (filtered by channel short name and date conditionals) to Stash's set_list tag
  3. Used Stash's get_list tag to display the results, specifying your overall limit there
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.