Skip to main content

Channel Entries

The Channel Entries tag is the primary tag used within your Templates to show the content you create and edit via your Control Panel’s Create or Edit section. It’s the most powerful tag in ExpressionEngine, and the most commonly used since its main function is to retrieve and display your site’s content.

The Channel Entries tag can display both multi-entry and single-entry content–that is, several entries on a page, or one specific entry.

note

Coilpack provides a slightly different experience for the classic channel entries tag when used in a Twig, Blade or GraphQL context. Most notably the dynamic parameter is not enabled by default Pagination is handled differently and some parameters may behave differently. See the ExpressionEngine Documentation for additional information on the Channel Entries Tag

{exp:channel:entries}
{title}
{/exp:channel:entries}

Parameters

The examples below are how the Channel Entries tag would look using every parameter. Please note that this is only for illustration purposes as some of these parameters would never be used together to achieve a meaningful result.

{exp:channel:entries
author_id="3"
category_id="2|45|4|9"
category="cars|sports"
channel="channel1|channel2"
dynamic="yes"
entry_id="not 45|534|807"
fixed_order="3|7|1"
group_id="4"
limit="1"
orderby="title"
search:body="pickles"
site="1"
sort="asc"
start_on="2023-01-01"
stop_before="2023-02-01"
url_title="my_wedding|my_honeymoon|my_kids"
username="petunia"
}
{title}
{/exp:channel:entries}

Author ID

The author_id parameter will limit the returned entries to the specified Member ID

author_id: 3

Category ID

Categories are specified by ID number (the ID number of each category is displayed in the Control Panel). The reason we use the ID is because categories can be called anything (with spaces, quotes, etc.), and also renamed. It would be much more difficult to have to update the tag parameters every time you updated a category name. Further, you can have multiple categories with the same name either in different Category Groups or in different parts of the hierarchy within the same Category Group.

And as with some of the other parameters, you can stack categories to get entries with any of those categories

category_id: "2|45|4|9"

Or use "not" to exclude categories

category_id: "not 4|5|7"

Category

This parameter works in the same way as category_id but takes the category url_title instead of an id. Please be aware that there are pitfalls to using the url_title mentioned above.

category: "cars|sports"

Channel

Choose which channel to show the entries (will show all channels if no channel is specified).

channel: "blog"

Additionally, you can use the pipe character to separate multiple channels:

channel: "channel1|channel2|channel3"

Or you can add the word "not" (with a space after it) to exclude channels:

channel: "not channel1|channel2|channel3"

Dynamic

When enabled the channel entries tag will select an entry dynamically based on what is in the URL. The native ExpressionEngine Channel Entries tag has dynamic=true by default, however Coilpack operates differently and uses dynamic: false as a default.

If you want to list entries in a "sidebar" on your site and have them always be the same ones regardless of which page on your site you visit (main page, archives, comments, etc.) then you will want to use the default dynamic: false parameter.

dynamic: true

Entry ID

You can hard code the channel tag to show a specific channel entry.

entry_id: "147"

You may also specify multiple entries by separating them with the pipe character:

entry_id: "13|42|147"

Or use "not" to exclude entries::

entry_id: "not 45|534|807"

Fixed Order

You can hard code the channel entries tag to show entries in a specific order based on their entry ids. Entries will be displayed in the order specified in the pipe delimited list. In the example below, the three entries with id’s 3, 7, and 1 would be displayed in that order.

fixed_order: "3|7|1"

Group ID

Limit

This parameter limits the number of entries on any given page. The limit will default to all entries if a value is not specified.

limit: 5

Orderby

The orderby parameter sets the display order of the entries.

orderby: "title"

The search parameter allows you to constrain Channel Entries output based on content within your fields. You specify which field to search by using the field’s short name as a key in the parameter value. You can search based on whether a field is an exact match to your provided term or whether or not a field simply contains your term.

search: {body: "pickles"}

Site

The site parameter restricts the entries to your specified site_id.

site: "1"

Sort

The sort order can be ascending or descending. The order will default to “descending” if nothing is specified.

Start On

You can specify a particular date/time on which to start the entries. Only entries that are on or after this date will be included in the display. This parameter is often used together with the stop_before= parameter for limiting the entry display to a specific date range.

Stop Before

You can specify a particular date/time on which to end the entries. Only entries that are before this date will be included in the display (entries exactly on this date/time will not be included). This parameter is often used together with the start_on= parameter for limiting the entry display to a specific date range.

URL Title

This parameter limits the query by an entry’s url_title. You can use the pipe character to query by multiple url_titles:

url_title: "my_wedding|my_honeymoon|my_kids"

Or you can add "not" to exclude url_titles:

url_title: "not my_in_laws"

Pagination

Coilpack is using Laravel's Pagination library. For more information on how to customize the response please consult the documentation on displaying pagination results.

{exp:channel:entries paginate="top"}
{title}
{/exp:channel:entries}