Skip to content

Instantly share code, notes, and snippets.

@nerrad
Created July 23, 2017 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerrad/ad44761d77a01dc05e80ae6c20bd8d5b to your computer and use it in GitHub Desktop.
Save nerrad/ad44761d77a01dc05e80ae6c20bd8d5b to your computer and use it in GitHub Desktop.
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