<?php /** * Automagic integration for the_excerpt. * * @package Webcomic * @uses WebcomicTag::the_webcomic() */ $prepend = "<div class='integrated-webcomic'><div class='webcomic-img'>" . WebcomicTag::the_webcomic("medium", "self") . "</div><!-- .webcomic-img --></div><!-- .integrated-webcomic -->";
/** * Render the widget. * * @param array $args General widget arguments. * @param array $instance Specific instance arguments. * @uses WebcomicTag::the_webcomic() * @uses WebcomicTag::get_webcomic_collection() * @uses WebcomicTag::get_webcomic_collections() */ public function widget($args, $instance) { global $post; $temp_post = $post; extract($args); extract($instance); if (!$collection) { $collection = WebcomicTag::get_webcomic_collection(); } elseif (-1 === (int) $collection) { $collection = WebcomicTag::get_webcomic_collections(); } if ($collection) { $the_posts = new WP_Query(array('post_type' => $collection, 'posts_per_page' => $numberposts, 'post_status' => 'future')); if ($the_posts->have_posts()) { echo $before_widget, empty($title) ? '' : $before_title . $title . $after_title, '<ul class="scheduled-webcomics">'; while ($the_posts->have_posts()) { $the_posts->the_post(); echo '<li><figure>', $image ? WebcomicTag::the_webcomic($image) : get_the_title('', '', false), $date ? '<figcaption>' . get_the_time(get_option('date_format')) . '</figcaption>' : '', '</figure></li>'; } echo '</ul>', $after_widget; } } $post = $temp_post; }
/** * Start element output. * * @param string $output Walker output string. * @param object $term Current term being handled by the walker. * @param integer $depth Depth the walker is currently at. * @param array $args Arguments passed to the walker. * @uses WebcomicTag::get_relative_webcomic_link() * @filter string webcomic_term_list_title Filters the term titles used by `webcomic_list_storylines` and `webcomic_list_characters`. * @filter string webcomic_term_image Filters the term images used by `webcomic_list_storylines` and `webcomic_list_characters`. * @filter string webcomic_term_description Filters the term titles used by `webcomic_dropdown_transcript_languages`. * @filter string term_list_webcomic_title Fitlers the webcomic titles used by `webcomic_list_storylines` and `webcomic_list_characters`. */ public function start_el(&$output, $term, $depth = 0, $args = array(), $current = 0) { global $post; $temp_post = $post; extract($args, $args['hierarchical'] ? EXTR_SKIP : EXTR_OVERWRITE); $term_title = apply_filters('webcomic_term_list_title', esc_attr($term->name), $term); $feed_image = filter_var($feed, FILTER_VALIDATE_URL); $feed_link = $feed ? '<a href="' . get_term_feed_link($term->term_id, $term->taxonomy, $feed_type) . '" class="webcomic-term-feed">' . ($feed_image ? '<img src="' . $feed . '" alt="' . sprintf(__('Feed for %s', 'webcomic'), $term->name) . '">' : $feed) . '</a>' : ''; if ($webcomics) { $the_posts = new WP_Query(array('posts_per_page' => -1, 'post_type' => str_replace(array('_storyline', '_character'), '', $term->taxonomy), 'order' => $webcomic_order, 'orderby' => $webcomic_orderby, 'tax_query' => array(array('taxonomy' => $term->taxonomy, 'field' => 'id', 'include_children' => false, 'terms' => $term->term_id)))); $output .= '<li class="webcomic-term ' . $term->taxonomy . ' webcomic-term-' . $term->term_id . ($selected === $term->term_id ? ' current' : '') . '"><a href="' . ('archive' === $target ? get_term_link($term, $term->taxonomy) : WebcomicTag::get_relative_webcomic_link($target, $term->term_id, false, $term->taxonomy, preg_replace('/_(storyline|character)$/', '', $term->taxonomy))) . '" class="webcomic-term-link"><div class="webcomic-term-name">' . $term_title . ($show_count ? " ({$term->count})" : '') . '</div>' . (($show_image and $term->webcomic_image) ? '<div class="webcomic-term-image">' . apply_filters('webcomic_term_image', wp_get_attachment_image($term->webcomic_image, $show_image), $show_image, $term) . '</div>' : '') . '</a>' . (($show_description and $term->description) ? '<div class="webcomic-term-description">' . apply_filters('webcomic_term_description', $term->description, $term) . '</div>' : '') . $feed_link; if ($the_posts->have_posts()) { $output .= '<' . ($ordered ? 'ol' : 'ul') . ' class="webcomics">'; $i = 0; while ($the_posts->have_posts()) { $the_posts->the_post(); $i++; $output .= '<li' . ($selected === get_the_ID() ? ' class="current"' : '') . '><a href="' . apply_filters('the_permalink', get_permalink()) . '">' . ($webcomic_image ? WebcomicTag::the_webcomic($webcomic_image, 'self') : apply_filters('term_list_webcomic_title', the_title('', '', false), get_post(), $i)) . '</a></li>'; } $output .= $ordered ? '</ol>' : '</ul>'; } } else { $output .= '<li class="webcomic-term ' . $term->taxonomy . ' webcomic-term-' . $term->term_id . ($selected === $term->term_id ? ' current' : '') . '"><a href="' . ('archive' === $target ? get_term_link($term, $term->taxonomy) : WebcomicTag::get_relative_webcomic_link($target, $term->term_id, false, $term->taxonomy, preg_replace('/_(storyline|character)$/', '', $term->taxonomy))) . '" class="webcomic-term-link"><div class="webcomic-term-name">' . $term_title . ($show_count ? " ({$term->count})" : '') . '</div>' . (($show_image and $term->webcomic_image) ? '<div class="webcomic-term-image">' . apply_filters('webcomic_term_image', wp_get_attachment_image($term->webcomic_image, $show_image), $show_image, $term) . '</div>' : '') . '</a>' . (($show_description and $term->description) ? '<div class="webcomic-term-description">' . apply_filters('webcomic_term_description', $term->description, $term) . '</div>' : '') . $feed_link; } $post = $temp_post; }
/** * Handle the_webcomic shortcode. * * @param array $atts Shortcode attributes. * @return string * @uses WebcomicTag::the_webcomic() */ public function the_webcomic($atts) { extract(shortcode_atts(array('size' => 'full', 'relative' => '', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'storyline', 'the_post' => false), $atts)); return WebcomicTag::the_webcomic($size, $relative, $in_same_term, $excluded_terms, $taxonomy, $the_post); }