コード例 #1
0
function ceo_display_comic_gallery($size = 'full')
{
    global $post;
    $output = '';
    if (ceo_pluginfo('click_comic_next')) {
        if (ceo_pluginfo('navigate_only_chapters')) {
            $next_comic = ceo_get_next_comic_in_chapter_permalink();
        } else {
            $next_comic = ceo_get_next_comic_permalink();
        }
    }
    $hovertext = ceo_the_hovertext();
    $comic_galleries_full = get_post_meta($post->ID, 'comic-gallery-full', true);
    if ($comic_galleries_full) {
        $comic_lightbox = get_post_meta($post->ID, 'comic-open-lightbox', true);
        $comic_galleries_jquery = get_post_meta($post->ID, 'comic-gallery-jquery', true);
        if ($images = get_posts(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC'))) {
            $count = 0;
            if ($comic_galleries_jquery) {
                wp_enqueue_script('multicomic', ceo_pluginfo('plugin_url') . 'js/multicomic.js', null, null, true);
            }
            foreach ($images as $image) {
                if ($comic_galleries_jquery) {
                    $output .= '<div id="comic-' . $count . '" class="comicpane">';
                }
                $thumbnail = wp_get_attachment_image_src($image->ID, 'full');
                $thumbnail = reset($thumbnail);
                //				$thumbnail = apply_filters('jetpack_photon_url', $thumbnail);
                if ($comic_lightbox) {
                    $output .= '<a href="' . $thumbnail . '" title="' . $hovertext . '" rel="lightbox">';
                }
                if (ceo_pluginfo('click_comic_next') && !empty($next_comic) && !$comic_lightbox) {
                    $output .= '<a href="' . $next_comic . '" title="' . $hovertext . '">';
                }
                $output .= '<img src="' . $thumbnail . '" alt="' . $hovertext . '" title="' . $hovertext . '" />';
                if (ceo_pluginfo('click_comic_next') && !empty($next_comic) || $comic_lightbox) {
                    $output .= '</a>';
                }
                if ($comic_galleries_jquery) {
                    $output .= "</div>\r\n";
                }
                $count += 1;
            }
            if ($comic_galleries_jquery) {
                $output .= "<button id=\"show-" . $count . "\" type=\"button\" style=\"display:none;\">" . $count . "</button>\r\n";
            }
            //			if ($comic_lightbox) $output .= '<div class="comic-lightbox-text">'.__('Click comic to view larger version.','comiceasel').'</div>';
        }
    } else {
        $output .= ceo_display_featured_image_comic($size);
        $columns = get_post_meta($post->ID, 'comic-gallery-columns', true);
        if (empty($columns)) {
            $columns = 5;
        }
        $args = array('id' => $post->ID, 'columns' => $columns, 'exclude' => array($post->ID));
        $output .= gallery_shortcode($args);
    }
    return apply_filters('ceo_display_comic_gallery', $output);
}
コード例 #2
0
function ryuzine_display_comic()
{
    global $post;
    $output = '';
    // ComicPress 2.x
    if (function_exists('comicpress_the_hovertext')) {
        $comics = get_comic_path('comic', $post);
        if (is_array($comics)) {
            foreach ($comics as $comic) {
                $cdn_url = comicpress_themeinfo('cdn_url');
                if (!empty($cdn_url)) {
                    $thumbnail = trailingslashit($cdn_url) . comicpress_clean_url($comic);
                } else {
                    $thumbnail = comicpress_themeinfo('baseurl') . comicpress_clean_url($comic);
                }
                $hovertext = comicpress_the_hovertext($post);
            }
        }
    }
    // Comic Easel (ComicPress 4)
    if (function_exists('ceo_the_hovertext')) {
        $post_image_id = get_post_thumbnail_id($post->ID);
        if ($post_image_id) {
            // If there's a featured image.
            $hovertext = ceo_the_hovertext();
            $thumbnail = wp_get_attachment_image_src($post_image_id, 'full', false);
            if (is_array($thumbnail)) {
                $thumbnail = reset($thumbnail);
            }
        }
    }
    // MangaPress
    if (defined('MP_FOLDER')) {
        $post_image_id = get_post_thumbnail_id($post->ID);
        if ($post_image_id) {
            $hovertext = '';
            $thumbnail = wp_get_attachment_image_src($post_image_id, 'full', false);
            if (is_array($thumbnail)) {
                $thumbnail = reset($thumbnail);
            }
        }
    }
    $output .= '<img src="' . $thumbnail . '" alt="' . $hovertext . '" title="' . $hovertext . '" />';
    return apply_filters('ryuzine_display_comic', $output);
}