From 0c271311b5a0b8d9fc912b05857c2d3407e1f768 Mon Sep 17 00:00:00 2001 From: "Philip M. Hofer (Frumph)" Date: Sat, 26 Dec 2009 08:06:56 -0800 Subject: [PATCH] thumbnail change - comic post thumbnails will not display above the post for the comic post, the thumbnail is now used as an alternative for the latest thumbnail widget, if has_thumbnail the latest thumbnail widget will display that thumbnail inside the widget. the_widget('ComicPressLatestThumbnailWidget','title=Latest Comic&onlyhome=true'); New option in the thumbnail 'onlyhome' will allow someone to have the thumbnail only display in on the homepage if widget enabled, off it will display everywhere it's placed. Since it's a widget it can be used in site design for placement of an alternate image to the comic i.e. lfgcomic Signed-off-by: Philip M. Hofer (Frumph) --- functions/displaypost.php | 4 +-- sidebar-right.php | 2 +- style.css | 10 +++++++ widgets/LatestThumbnailWidget.inc | 48 +++++++++++++++++-------------- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/functions/displaypost.php b/functions/displaypost.php index beb9cfc..c6e1671 100644 --- a/functions/displaypost.php +++ b/functions/displaypost.php @@ -14,9 +14,9 @@ function comicpress_display_post_title($is_comic = false) { echo apply_filters('comicpress_display_post_title',$post_title); } -function comicpress_display_post_thumbnail() { +function comicpress_display_post_thumbnail($is_comic = false) { global $post; - if (function_exists('has_post_thumbnail')) { + if (function_exists('has_post_thumbnail') && !$is_comic) { if ( has_post_thumbnail() ) { $post_thumbnail = "\r\n"; echo apply_filters('comicpress_display_post_thumbnail',$post_thumbnail); diff --git a/sidebar-right.php b/sidebar-right.php index 0eaa854..51e252b 100644 --- a/sidebar-right.php +++ b/sidebar-right.php @@ -10,7 +10,7 @@ if (!$comicpress_options['disable_lrsidebars_frontpage']) { ?> the_widget('ComicPressArchiveDropdownWidget', 'mode=storyline_order'); } if ($comicpress_options['disable_comic_frontpage']) { - the_widget('ComicPressLatestThumbnailWidget'); + the_widget('ComicPressLatestThumbnailWidget','title=Latest Comic&onlyhome=true'); } the_widget('WP_Widget_Pages'); the_widget('WP_Widget_Categories','hierarchical=1&count=1'); diff --git a/style.css b/style.css index a5df0a0..b4a2939 100644 --- a/style.css +++ b/style.css @@ -859,6 +859,16 @@ ul.children { padding: 3px; } + .sidebar .ComicPressLatestThumbnailWidget h2 { + text-align: left; + } + + .sidebar .ComicPressLatestThumbnailWidget { + text-align: center; + } + + + /* WIDGETS */ .random-comic-icon, .random-post-icon { diff --git a/widgets/LatestThumbnailWidget.inc b/widgets/LatestThumbnailWidget.inc index e3d831b..57f44e9 100644 --- a/widgets/LatestThumbnailWidget.inc +++ b/widgets/LatestThumbnailWidget.inc @@ -19,43 +19,49 @@ class ComicPressLatestThumbnailWidget extends WP_Widget { } function widget($args, $instance) { - global $post; - if (is_home()) { - extract($args, EXTR_SKIP); - - echo $before_widget; - $title = empty($instance['title']) ? __('Latest Comic','comicpress') : apply_filters('widget_title', $instance['title']); - if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; - $latestcomics = get_posts('numberposts=1&category='.get_all_comic_categories_as_cat_string()); - $archive_image = null; + global $post, $wp_query; + if (!is_home() && $instance['onlyhome']) return; + + extract($args, EXTR_SKIP); + echo $before_widget; + $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); + if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; + $latestcomics = get_posts('numberposts=1&category='.get_all_comic_categories_as_cat_string()); + $archive_image = null; - foreach($latestcomics as $post) : + foreach($latestcomics as $post) : foreach (array("archive", "rss", "mini", "comic") as $type) { if (($requested_archive_image = get_comic_url($type, $post)) !== false) { - $archive_image = $requested_archive_image; break; + $archive_image = "\"".get_the_title()."\""; + break; } - } ?> -
- <?php the_title() ?> - <?php the_date(); ?>
- -
- ID) ) { + $archive_image = get_the_post_thumbnail($post->ID,'full'); + } + } + ?> + + '' ) ); + $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'onlyhome' => false ) ); $title = strip_tags($instance['title']); + $onlyhome = $instance['onlyhome']; ?>

-

+