[insert_php]
$args = array(
//’pad_counts’ => 1,
//’orderby’ => ‘menu_order’,
//’order’ => ‘DESC’,
‘hide_empty’ => 0,
‘parent’ => 0
);
$parent_chapters = get_terms( ‘chapters’, $args );
function storySort($a, $b){
$aorder = $a->menu_order;
$border = $b->menu_order;
if ($aorder == $border) {
return 0;
}
return ($aorder < $border) ? -1 : 1;
}
[/insert_php]
Hey, listen! Looking for a place to start reading? You should be able to hop into the latest arc without missing too much. Or, you can hop back a little further and learn the super secret adventure-type origins of the Badnix!
Early Comics
-
[insert_php]
$parent_chapter = $parent_chapters[0];
$output = ”;
$parent_args = array(
‘numberposts’ => 1,
‘post_type’ => ‘comic’,
‘orderby’ => ‘post_date’,
‘order’ => ‘ASC’,
‘post_status’ => ‘publish’,
‘chapters’ => $parent_chapter->slug,
);
$qposts = get_posts( $parent_args );
if (is_array($qposts) && !is_wp_error($qposts)) {
$qposts = reset($qposts);
//if ($parent_chapter->count) $count = ‘ (‘.$parent_chapter->count.’) ‘;
}
$child_chapters = get_term_children( $parent_chapter->term_id, ‘chapters’ );
// MODIFICATION!!! Sorting stories
$stories = array();
foreach($child_chapters as $child) {
$term = get_term_by(‘id’,$child,’chapters’);
array_push($stories, $term);
}
usort($stories,storySort);
foreach ($stories as $child_term) {
if ($child_term->count) {
$child_args = array(
‘numberposts’ => 1,
‘post_type’ => ‘comic’,
‘orderby’ => ‘post_date’,
‘order’ => ‘ASC’,
‘post_status’ => ‘publish’,
‘chapters’ => $child_term->slug
);
$qcposts = get_posts( $child_args );
var_dump($qcposts);
if (is_array($qcposts)) {
$qcposts = reset($qcposts);
$output .= “
- “; $output .= “ID) . “‘>”; $output .= “” . $child_term->name . ““; //$output .= get_the_post_thumbnail( $qcposts->ID, ‘thumbnail’ ); $output .= ““; $output .= “ID) . “‘>”; $output .= “WORLD 1-” . $counter . “” . $child_term->name . ““; //$output .= get_the_post_thumbnail( $qcposts->ID, ‘thumbnail’ ); $output .= ““; $output .= “ID) . “‘>”; $output .= “WORLD 2-” . $counter . “” . $child_term->name . ““; //$output .= get_the_post_thumbnail( $qcposts->ID, ‘thumbnail’ ); $output .= ““; $output .= “ID) . “‘>”; $output .= “WORLD 3-” . $counter . “” . $child_term->name . ““; //$output .= get_the_post_thumbnail( $qcposts->ID, ‘thumbnail’ ); $output .= ““; $output .= “ID) . “‘>”; $output .= “WORLD 4-” . $counter . “” . $child_term->name . ““; //$output .= get_the_post_thumbnail( $qcposts->ID, ‘thumbnail’ ); $output .= ““; $output .= “