Comment Entries
The Comment Entries Tag enables you to show the user-submitted comments associated with your entries.
Coilpack provides a slightly different experience for the comment entries tag when used in a Twig, Blade or GraphQL context. Pagination is handled differently and some parameters may behave differently. See the ExpressionEngine Documentation for additional information on the Comment Entries Tag
- Native
- Twig
- Blade
- GraphQL
{exp:comment:entries}
{comment}
{/exp:comment:entries}
{% for entry in exp.comment.entries %}
{{ entry.comment }}
{% endfor %}
@foreach($exp->comment->entries as $entry)
{{ $entry->comment }}
@endforeach
{
exp_comment_entries {
data {
comment
}
}
}
Parameters
The examples below are how the Comment 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.
- Native
- Twig
- Blade
- GraphQL
{exp:comment:entries
author_id="5"
channel="channel1|channel2"
comment_id="22"
dynamic="yes"
entry_id="not 45|534|807"
entry_status="Featured"
limit="30"
orderby="date"
site="1"
sort="asc"
status="Closed"
url_title="my_wedding"
}
{comment}
{/exp:comment:entries}
{% for entry in exp.comment.entries({
author_id: "5",
channel: "channel1|channel2",
comment_id: "22",
dynamic: true,
entry_id: "not 45|534|807",
entry_status: "Featured",
limit: "30",
orderby: "date",
site: "1",
sort: "asc",
status: "Closed",
url_title: "my_wedding"
}) %}
{{ entry.comment }}
{% endfor %}
@foreach($exp->comment->entries([
"author_id" => "5",
"channel" => "channel1|channel2",
"comment_id" => "22",
"dynamic" => true,
"entry_id" => "not 45|534|807",
"entry_status" => "Featured",
"limit" => "30",
"orderby" => "date",
"site" => "1",
"sort" => "asc",
"status" => "Closed",
"url_title" => "my_wedding"
]) as $entry)
{{ $entry->comment }}
@endforeach
{
exp_comment_entries(
author_id: "5",
channel: "channel1|channel2",
comment_id: "22",
dynamic: true,
entry_id: "not 45|534|807",
entry_status: "Featured",
limit: "30",
orderby: "date",
site: "1",
sort: "asc",
status: "Closed",
url_title: "my_wedding"
) {
comment
}
}
Author ID
The author_id
parameter will limit the returned entries to the specified Member ID
author_id: 3
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"
Comment ID
You can hard code the comment entries tag to show specific comments. As with the `entry_id`` parameter, you may also specify multiple comments by separating them with the pipe character.
comment_id: "22"
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"
Entry Status
Restrict comments to those belonging to entries with a specified status.
entry_status: "Featured"
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"
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.
Status
Restrict to entries with a particular status
status: "Closed"
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"