Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Series Grouping Table of Contents Template Example
<?php
/*
* Template Name: OrgSeries Grouping Table of Contents
* Note: This is template is specific to the them it was designed for. The html structure will vary for your active theme.
*/
?>
<?php get_header(); ?>
<?php /** organize-series-grouping related, block 1 **/ ?>
<?php
//let's start outputting all the series info.
// args choosing what series groups I want to display on this page
// (via series_group_ids, i.e. the ids of the categories that are series groups)
$args = array(
'include' => array( '25', '22', '6' ),
'order' => 'DESC',
'orderby' => 'term_id'
);
// args for getting series information in the listed group.
$get_series_args = array(
'hide_empty' => 1,
);
// getting all group information.
$groups = get_series_groups( $args );
foreach ( $groups as $group ) {
echo '<div class="entry post clearfix">';
echo '<h3 id="group-title-'.$group->term_id.'" class="group-title">'.$group->name.'</h3>';
//this is getting the series data for the displayed group.
$get_series = get_series_in_group($group->term_id, $get_series_args);
//args used for the wp_serieslist_display function
$series_args = array(
'include' => $get_series,
'order' => 'DESC'
);
//this is a organize-series template tag. I'm sending to it the list of series_ids for the currently displayed group
//and then it will output the series information according to the serieslist_display template in series options.
wp_serieslist_display(false, $series_args);
echo '</div>';
}
?>
</div> <!-- end #content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment