{% paginate %}

Comment Works provides an ElementQuery so you can use the {% paginate %} tags.

The example below creates pages of 3 entries, and shows all entries (pending, trashed, approved, spam) for documentation purposes.


{# @var commentsWork \twentyfourhoursmedia\commentswork\services\CommentsWorkService #} {% set commentsWork = craft.commentsWork.service %}

{# @var query \twentyfourhoursmedia\commentswork\elements\db\CommentQuery #} {% set query = commentsWork.createElementQuery %}

{% paginate query.commentStatus(null).element(entry).limit(3) as pageInfo, pageEntries %} {% if comments | length == 0 %}

(no comments)

{% else %}
    {% for comment in comments %}
  • ID:{{ comment.id }} STATUS:{{ comment.status }} FOR ELEMENT:{{ comment.elementId }} TITLE:{{ comment.title }}
  • {% endfor %}
{% endif %}

{% if pageInfo.prevUrl %}Previous Page{% endif %} {% if pageInfo.nextUrl %}Next Page{% endif %}