<p>You could probably do this purely from Twig / a template, but I think it's going to end up being much easier from a plugin / PHP.</p>

<p>The general gist of it would be:</p>

<ol>
<li><p>Grab all entries from section 1 ordered by postDate.</p></li>
<li><p>Grab all entries from section 2 ordered by releaseDate.</p></li>
<li><p>Create a new array and loop through 1 and 2 inserting via your custom sorting logic.</p></li>
<li><p>Return that new sorted array back to the template.</p></li>
</ol>

CC BY-SA 3.0
2014-11-09T21:22:50.730Z
2014-11-09T21:22:50.730Z
Brad Bell
<p>As an alternative, you could also simply create the first entry as usual, setting the post date to the post date. Then use a plugin like <a href="https://github.com/am-impact/amcommand" rel="nofollow">AM Command</a> to duplicate the entry, add 'is out now!' to the title, alter any other content as needed, and set the post date to the release date. This would give you a lot more flexibility regarding title and content, etc., and without the need for a custom plugin. The game entry itself could even be in an entirely separate channel and pulled into any news related to it via a related entries field. This would allow you to create other news events as well, such as 'release delayed!', etc.</p>

CC BY-SA 3.0
2014-11-10T13:42:32.760Z
Thank you for your answer! Although this is not exactly the solution I'm looking for since I would only like to display one entry twice and not create a duplicate entry. So I think I'll have to go with Brad's solution for my specific problem.
Hasco
CC BY-SA 3.0
2014-11-10T16:05:04.887Z
Of course. No problem. I just thought I would throw out some other options for you to consider. Keep in mind, you can also have an article that has no body and just dynamically pulls in content from the other article (even from the same channel) via related entry. So no duplicate. Just the title and post date (aka release date). I've used this kind of article linking in some of my projects and seems to work really well. Basically, lots of options.
Douglas McDonald
CC BY-SA 3.0
2014-11-10T18:37:29.603Z
Thanks, I was thinking of similar kind of approach if other options run short. I'll have to figure out what suits the purpose best, maybe even by trial and error.
Hasco
CC BY-SA 3.0
2014-11-09T23:05:20.683Z
2014-11-09T23:05:20.683Z
Douglas McDonald
<p>I'm building a feed of entries mixed from different sections. One section contains a postDate and a custom field date called releaseDate. I want these entries to appear in the feed with their postDate, but when the releaseDate is equivalent to <code>now</code> I want the entry to return in the feed in order of appearance. Is this possible?</p>

<p>I've tried something like this:</p>

<pre><code>craft.entries.section(['section1', 'section2']).order(['postDate DESC', 'releaseDate DESC'])
</code></pre>

CC BY-SA 3.0
2014-11-09T19:54:15.413Z
I'm not sure I'm following. Can you give some sample data and how you'd like it to ultimately output?
Brad Bell
CC BY-SA 3.0
2014-11-09T20:07:56.420Z
I'm building a feed for games on a news site, each game has a postDate as in when it's announced and a releaseDate for when the game is actually released. The games are presented in a feed combined with related news posts, also with a postDate. The feed is initially ordered by the postDate. So for example you have a feed looking like this: Call of Duty Advanced Warfare is announced -> Some news entry -> Some news entry -> **Call of Duty Advanced Warfare is out now!**. So I would like to repeat the game entry within the feed from the point when it is released.
Hasco
CC BY-SA 3.0
2014-11-09T20:47:53.920Z
So "Call of Duty Advanced Warfare" and "Call of Duty Advanced Warfare is out now" are the same entry, you've just updated the title? Or they are two separate entries?
Brad Bell
CC BY-SA 3.0
2014-11-09T21:06:28.393Z
They are the same entry with the same title, the "is out now" part will be added in the front-end. I want to apologize for the vagueness of my question, it's kinda hard to explain.
Hasco
<entries><datetime><custom-field><loop>
Is there a way of displaying an entry twice depending on postDate and a custom field date in one loop?
# Is there a way of displaying an entry twice depending on postDate and a custom field date in one loop?

(Asked by: username_0 on 2014-11-09)

I'm building a feed of entries mixed from different sections. One section contains a postDate and a custom field date called releaseDate. I want these entries to appear in the feed with their postDate, but when the releaseDate is equivalent to now I want the entry to return in the feed in order of appearance. Is this possible?
I've tried something like this:
craft.entries.section(['section1', 'section2']).order(['postDate DESC', 'releaseDate DESC'])

**Tags:** entries, datetime, custom-field, loop

> **Comments:**
> **username_1**: I'm not sure I'm following. Can you give some sample data and how you'd like it to ultimately output?  
> **username_0**: I'm building a feed for games on a news site, each game has a postDate as in when it's announced and a releaseDate for when the game is actually released. The games are presented in a feed combined with related news posts, also with a postDate. The feed is initially ordered by the postDate. So for example you have a feed looking like this: Call of Duty Advanced Warfare is announced -> Some news entry -> Some news entry -> **Call of Duty Advanced Warfare is out now!**. So I would like to repeat the game entry within the feed from the point when it is released.  
> **username_1**: So "Call of Duty Advanced Warfare" and "Call of Duty Advanced Warfare is out now" are the same entry, you've just updated the title? Or they are two separate entries?  
> **username_0**: They are the same entry with the same title, the "is out now" part will be added in the front-end. I want to apologize for the vagueness of my question, it's kinda hard to explain.  

---

## 2 answers

### Answer by username_1 on 2014-11-09. Score: 2 | Accepted answer

You could probably do this purely from Twig / a template, but I think it's going to end up being much easier from a plugin / PHP.

The general gist of it would be:

1. Grab all entries from section 1 ordered by postDate.
2. Grab all entries from section 2 ordered by releaseDate.
3. Create a new array and loop through 1 and 2 inserting via your custom sorting logic.
4. Return that new sorted array back to the template.


---

### Answer by username_2 on 2014-11-09. Score: 1

As an alternative, you could also simply create the first entry as usual, setting the post date to the post date. Then use a plugin like [AM Command](https://github.com/am-impact/amcommand) to duplicate the entry, add 'is out now!' to the title, alter any other content as needed, and set the post date to the release date. This would give you a lot more flexibility regarding title and content, etc., and without the need for a custom plugin. The game entry itself could even be in an entirely separate channel and pulled into any news related to it via a related entries field. This would allow you to create other news events as well, such as 'release delayed!', etc.

> **Comments:**
> **username_0**: Thank you for your answer! Although this is not exactly the solution I'm looking for since I would only like to display one entry twice and not create a duplicate entry. So I think I'll have to go with Brad's solution for my specific problem.  
> **username_2**: Of course. No problem. I just thought I would throw out some other options for you to consider. Keep in mind, you can also have an article that has no body and just dynamically pulls in content from the other article (even from the same channel) via related entry. So no duplicate. Just the title and post date (aka release date). I've used this kind of article linking in some of my projects and seems to work really well. Basically, lots of options.  
> **username_0**: Thanks, I was thinking of similar kind of approach if other options run short. I'll have to figure out what suits the purpose best, maybe even by trial and error.  

---

