perch_blog_sections()

Output a list of the sections set up for the blog with perch_blog_sections().

Creating two Blog Sections can be useful if you want to have two distinct blog or news-like sections of your site. For example a traditional Blog and a company news page.

Requires

Parameters

Type Description
Array Options array, see table below
Boolean Set to true to have the value returned instead of echoed.

Options array

Name Value
template The template to use.
skip-template true/false. Return an array rather than HTML.
cache true/false. By default, output is cached for 10 minutes.
include-empty true/false. Include sections that have no posts.
filter Results can be filtered using the same filter options as perch_content_custom(). Includes support for multiple filters.
blog The slug of the blog to pull content from. See Multiple Blogs.
sort The ID of a field to sort by.
sort-order ASC/DESC
start Int. The start position. Defaults to 1. Not compatible with pagination.
return-html true/false. For use with skip-template. Adds the HTML onto the end of the returned array
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

A list of all sections using the default template.

<?php perch_blog_sections(); ?>

An options array can be passed as the first argument.

<?php
    perch_blog_sections(array(
        'template' => 'my_section_template.html',
    ));
?>