Archive

[insert_php] $args = array( //’pad_counts’ => 1, //’orderby’ => ‘menu_order’, //’order’ => ‘DESC’, ‘hide_empty’ => 0, ‘parent’ => 0 ); $parent_chapters = get_terms( ‘chapters’, $args ); function getChapter($i) { } [/insert_php]

Hey, listen! Looking for a place to start reading? You should be able to hop into the latest arc without skipping a beat. 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 ); if (is_array($qcposts)) { $qcposts = reset($qcposts); $output .= “
  • “; $output .= “” . $child_term->name . ““; $output .= ““; $output .= “
  • “; } } } echo $output; [/insert_php]

World 1 – The Enemy

    [insert_php] $parent_chapter = $parent_chapters[1]; $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); $counter = 0; 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 ); if (is_array($qcposts)) { $qcposts = reset($qcposts); $counter++; $output .= “
  • “; $output .= “1-” . $counter . ” – ” . $child_term->name . ““; $output .= ““; $output .= “
  • “; } } } echo $output; [/insert_php]

World 2 – Bosses

    [insert_php] $parent_chapter = $parent_chapters[2]; $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); $counter = 0; 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 ); if (is_array($qcposts)) { $qcposts = reset($qcposts); $counter++; $output .= “
  • “; $output .= “2-” . $counter . ” – ” . $child_term->name . ““; $output .= ““; $output .= “
  • “; } } } echo $output; [/insert_php]

World 3 – Legends

    [insert_php] $parent_chapter = $parent_chapters[3]; $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); $counter = -1; 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 ); if (is_array($qcposts)) { $qcposts = reset($qcposts); $counter++; $output .= “
  • “; $output .= “3-” . $counter . ” – ” . $child_term->name . ““; $output .= ““; $output .= “
  • “; } } } echo $output; [/insert_php]