4 Things You Probably Don’t Know About ExpressionEngine Channel Entries

1.) Related Categories Mode

This options allows you to output other entries with the same category. It is to be used on only single entry pages. There are other ways to accomplish this but if it’s available why not use it?


{exp:channel:entries related_categories_mode=“yes” custom_fields=“yes” member_data=“yes”}
<h2>{title}</h2>
{body}
<div class=“posted”>Posted by {author} on {entry_date format=‘%m/%d’} at {entry_date format=‘%h:%i %A’}</div>
{/exp:channel:entries}

2.) Order by Date Field (Custom)

Natively you CANNOT display entries based on a custom date field.You can use the entry date and expiry date but not a custom field. Luckily the guys at Solspace have a FREE add-on that does just that. We have used it on a few event related sites and it’s works well.

3.) Disabling Relationships

You should be disabling as many things as you can to get maximum performance from your ExpressionEngine sites. Relationships is a little used parameter to speed things up further. Thanks to Solpace for this tip.

{exp:channel:entries channel=“news” limit=“10” disable=“categories|category_fields|member_data|relationships”}
<h2>{title}</h2>
{body}
{/exp:channel:entries}

4.) Channel Entries within Channel Entries

You cannot have an channel entries tag within a channel entries tag. The below will not work.

{exp:channel:entries channel=“meat“ limit=“10“ search:cf_meat_body=“steak“ }
{title}
…..OTHER Custom Fields

{if no_results}
    <h1>There are no results but please see these entries</h1>
    {exp:channel:entries channel=“meat“ limit=“10“ }
        {title}
        ….OTHER Custom Fields
    {/exp:channel:entries}
{/if}
{/exp:channel:entries}

Embeds

Embeds will work

{exp:channel:entries channel=“meat“ limit=“10“ search:cf_meat_body=“steak“}
{if no_results}
     <h1>There are no results but please see these entries</h1>
     {embed=“templategroup/embedname“}
{/if}
{title}
...OTHER Custom Fields
{/exp:channel:entries}

In embed template:

{exp:channel:entries channel=“meat“ limit=“5“}
{title}
…..OTHER Custom Fields 
{/exp:channel:entries}

The best way is to use a Low Variable

{exp:channel:entries channel=“tester“ limit=“1“ search:cf_meat_body=“steak“}

{if no_results}
<h1>There are no results but please see these entries</h1>
{exp:low_variables:parse var=“lv_embed“}{/if}
{title}
...OTHER Custom Fields
{/exp:channel:entries}

In low variables template:

{exp:channel:entries channel=“meat“ limit=“5“}
{title}
…..OTHER Custom Fields 
{/exp:channel:entries}

Hope you found that useful, what are your channel entries tips?

Leave a comment

" What you do not want to happen to you, do not do it yourself either" Sextus the Pythagorean