Cosmic Hellcats fame. Requires comic-easel by Philip M. Hofer (Frumph) Version: 1.2 Author: Christoper Maverick Author URI: http://chrismaverick.com License: GPL2 Copyright 2012 Christopher Maverick (email : mav@cosmichellcats.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ if (!defined('ABSPATH')) exit; // Only enqueue if the widget is active if (is_active_widget(false, false, 'ceo_casthover_reference_widget', true)) { add_filter('ceo_display_comic_characters', 'ceo_add_characters_hovercards'); add_action('wp_enqueue_scripts', 'ceo_casthover_res_init_scripts'); add_action('wp_print_styles', 'ceo_casthover_res_init_styles'); } function ceo_casthover_res_init_styles() { wp_register_style('casthover-css', ceo_pluginfo('plugin_url').'css/casthover.css', array(), '1.2'); wp_enqueue_style('casthover-css'); } function ceo_casthover_res_init_scripts() { wp_enqueue_script('casthover-js', ceo_pluginfo('plugin_url').'js/casthoverfunc.js', array('jquery'), '1.2', true); } function ceo_insert_character_hovercard($character) { $ccard = ''; if ($character) { $ccard .= '
'; $ccard .= do_shortcode('[cast-page character="'.$character.'"]'); $ccard .= '
'; } return $ccard; } function ceo_add_characters_hovercards($post_characters) { global $post; $mychars = '
'.__('Characters', 'comic-easel').': '; $terms = get_the_terms( $post->ID, 'characters' ); $return = ''; if ( !empty( $terms ) ) { $out = array(); foreach ( $terms as $term ) { $out[] = ''.wp_kses_post($term->name).''.ceo_insert_character_hovercard($term->slug).''; } $return = join( ', ', $out ); } $mychars .= $return . '
'; return $mychars; } //widget code below here class ceo_casthover_reference_widget extends WP_Widget { /** * Register widget with WordPress. */ function __construct() { parent::__construct( __CLASS__, // Base ID __( 'Comic Easel - Cast Hover', 'comic-easel' ), // Name array( 'classname' => __CLASS__, 'description' => __( 'Creates a grid of avatars for characters in the current comic.', 'comic-easel' ), ) // Args ); } function widget($args, $instance) { global $post; extract($args, EXTR_SKIP); ceo_protect(); if ((is_single() && ($post->post_type == 'comic')) || is_home() || is_front_page()) { if ( ((is_home() || is_front_page()) && (is_paged() || ceo_pluginfo('disable_comic_on_home_page') || is_page())) ) return; // This section allows the plugin to work in any sidebar even on home, except (paged) files if ((is_home() || is_front_page()) && !is_paged() && !ceo_pluginfo('disable_comic_on_home_page')) { $order = (ceo_pluginfo('display_first_comic_on_home_page')) ? 'asc' : 'desc'; $args = array( 'showposts' => 1, 'posts_per_page' => 1, 'order' => $order, 'post_type' => 'comic' ); $posts = get_posts($args); $post = reset($posts); } $post_characters = get_the_terms( $post->ID, 'characters'); if (!empty($post_characters)) { echo $before_widget; $title = apply_filters( 'widget_title', $instance['title'] ); if ($title) { echo $before_title . $title . $after_title; } ?>
'.ceo_insert_character_hovercard($mychar->slug).''; } echo join('',$out); ?>