diff --git a/functions/shortcodes.php b/functions/shortcodes.php index 1e1c188..394bd10 100644 --- a/functions/shortcodes.php +++ b/functions/shortcodes.php @@ -5,43 +5,48 @@ add_shortcode('cast-page', 'ceo_cast_page'); add_shortcode('comic-archive', 'ceo_comic_archive_multi'); add_shortcode('transcript', 'ceo_display_transcript'); -function ceo_cast_display($character) { +function ceo_cast_display($character, $stats, $image) { $cast_output = ''; if ($character) { - $cast_output .= '
'; $cast_output .= $character->description; $cast_output .= '
'; - $cast_output .= '';
- $cast_output .= ''.__('Comics:','comiceasel').' '.$character->count.'
';
- $args = array(
- 'post_type' => 'comic',
- 'orderby' => 'post_date',
- 'order' => 'ASC',
- 'post_status' => 'publish',
- 'characters' => $character->slug,
- );
- $qposts = get_posts( $args );
- if (!empty($qposts)) {
- $first_seen_object = reset($qposts);
- $first_seen_title = $first_seen_object->post_title;
- $first_seen_id = $first_seen_object->ID;
- $last_seen_object = end($qposts);
- $last_seen_title = $last_seen_object->post_title;
- $last_seen_id = $last_seen_object->ID;
- if ($first_seen_id == $last_seen_id) {
- $cast_output .= ''.__('Only Appearance:','comiceasel').' '.$first_seen_title.'
';
- } else {
- $cast_output .= ''.__('Recent Appearance:','comiceasel').' '.$last_seen_title.'
';
- $cast_output .= ''.__('First Appearance:','comiceasel').' '.$first_seen_title.'
';
+ if ($stats) {
+ $cast_output .= '
';
+ $cast_output .= ''.__('Comics:','comiceasel').' '.$character->count.'
';
+ $args = array(
+ 'post_type' => 'comic',
+ 'orderby' => 'post_date',
+ 'order' => 'ASC',
+ 'post_status' => 'publish',
+ 'characters' => $character->slug,
+ );
+ $qposts = get_posts( $args );
+ if (!empty($qposts)) {
+ $first_seen_object = reset($qposts);
+ $first_seen_title = $first_seen_object->post_title;
+ $first_seen_id = $first_seen_object->ID;
+ $last_seen_object = end($qposts);
+ $last_seen_title = $last_seen_object->post_title;
+ $last_seen_id = $last_seen_object->ID;
+ if ($first_seen_id == $last_seen_id) {
+ $cast_output .= ''.__('Only Appearance:','comiceasel').' '.$first_seen_title.'
';
+ } else {
+ $cast_output .= ''.__('Recent Appearance:','comiceasel').' '.$last_seen_title.'
';
+ $cast_output .= ''.__('First Appearance:','comiceasel').' '.$first_seen_title.'
';
+ }
}
+ $qposts = null;
+ $cast_output .= '