0

I have a channel entries call which is pulling in 2 channels (channel_1 and channel_2), what i want to be able to do is always make the first / latest post show from channel_1, even if channel_2 has an entry which is more recent.

The entries are order by date and the rest need to keep that flow. I want to keep this all in one channel call as i am using ajax pagination.

Any ideas of how i could just change the order of the first entry from a specific channel would be great.

1

You just might have to use an embed (or Stash if you're using that).

{ee-tag channel="channel_1" limit="1" ... }
   {!-- display first / latest entry of channel_1 --}
   {embed="embed/all-other-entries" no-show="{entry_id}"}
{/ee-tag}

Then the "all-other-entries" embed template would have:

{ee-tag channel="channel_l|channel_2" entry_id="not {embed:no-show}" ... }
   {!-- all entries except the latest from channel_1 --}
{/ee-tag}
|improve this answer|||||
0

You could use the native "Make Entry Sticky" option on the publish view in EE for the one entry you need to sit at the top.

|improve this answer|||||
  • Thank @StephenC. I wanted to see if i could do this without using that as i didn't want to have to keep going in and out of that entry to control the order as it maybe quite frequent – zizther May 9 '13 at 10:20
0

This might be of use, you can pipe multiple orderby like:

orderby="channel|date"

As per documentation.

|improve this answer|||||
  • I don't think you can order by channel. It's not something that's listed in the docs. – Ian May 9 '13 at 11:49
  • Could've sworn I did just that recently – stuartmcd69 May 9 '13 at 11:52
  • That would be great if it could order them by channel – zizther May 9 '13 at 12:00
  • But would you want to order by channel name, shortname, or channel ID? It wouldn't provide much control in ordering other than the alphabetical name of the channel. – Ian May 9 '13 at 12:16
  • True, good point @Ian – zizther May 10 '13 at 16:03
0

You could try something like this within your Channel Entries tags:

{!-- channel_1 entries get output first --}
{if channel_id == '1'}

    {title}
    {!-- Other field values here from channel_1 --}

{/if}

{!-- Other channel entries output afterwards --}
{if channel_id != '1'}

    {title}
    {!-- Other field values here from channel_1 --}

{/if}

Just to sure to change the channel_id to whatever your channel ID's are.

|improve this answer|||||
0

As of version 2.5.4 you can order by status - so in your status group you could have a "featured" status. It would have the same effect as sticky, basically, but be visible in the edit list view (which is important in my view). If only channel 1 used that status group (or even if both did but you only ever used "featured" on channel 1) it would have the effect you are going for. You would simply use orderby="status|date" and sort="asc|desc" to give preference to status over date sorting. This approach works best, however, if you only have two statuses - open and your additional custom status of "featured". If you have a bunch of others, it complicates things because the entries loop will still run through ordering by status before it orders by date.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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