perch_comments()

Comments are listed using the perch_comments() function.

Requires

Parameters

Type Description
String a slug or string that uniquely identifies the item being commented on
Array Options array, see table below
Boolean Set to true to have the value returned instead of echoed.

Options array

Name Value
template The name of an HTML template file in the templates/comments folder.
sort The field to sort by
sort-order ASC or DESC - the direction to sort in
paginate True or false. Whether to use pagination.
count Integer. (When used with paginate) The number of items to show per page if pagination is being used.
pagination-var The URL query string parameter name to use for the page number. Defaults to page.
page-links True or false. Create numbered page links as well as previous and next links.
page-link-template The template to use (if not the default) to generate the page links.
page-link-style shortened or all. By default a shortened set of page links are generated. If you want a link for every page, set to all.

Usage examples

Outputs the comments for the item identified as product123

<?php perch_comments('product123'); ?>

Pass in an alternate template.

<?php perch_comments_form('product123', array(
  template => 'my_template.html'
)); ?>

Return the comments rather than displaying them.

<?php $comments = perch_comments_form('product123', array(
  template => 'my_template.html'
),true); ?>