From a6118f1d43d6e0dba5351c5f1dabd6ce6c6b003c Mon Sep 17 00:00:00 2001 From: Frumph Date: Sun, 9 Oct 2016 12:37:25 -0700 Subject: [PATCH] New Option to allow Comic Easel to automagically remove featured images on comic post pages on non-ComicPress themes (so you don't have to code anything) --- ceo-config.php | 3 +- comiceasel.php | 12 +++-- functions/filters.php | 7 ++- lang/comiceasel-en_US.mo | Bin 279 -> 279 bytes lang/comiceasel-en_US.po | 86 +++++++++++++++++++---------------- options/general.php | 11 ++++- readme.txt | 7 ++- widgets/archive-dropdown.php | 30 ++++-------- 8 files changed, 88 insertions(+), 68 deletions(-) diff --git a/ceo-config.php b/ceo-config.php index 7859316..5f5d14e 100644 --- a/ceo-config.php +++ b/ceo-config.php @@ -26,7 +26,8 @@ if ( isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'update-op 'thumbnail_size_for_archive', 'thumbnail_size_for_facebook', 'custom_post_type_slug_name', - 'chapter_on_home' + 'chapter_on_home', + 'remove_post_thumbnail' ) as $key) { if (isset($_REQUEST[$key])) { $ceo_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]); diff --git a/comiceasel.php b/comiceasel.php index 696b02e..44cb25c 100644 --- a/comiceasel.php +++ b/comiceasel.php @@ -3,7 +3,7 @@ Plugin Name: Comic Easel Plugin URI: http://comiceasel.com Description: Comic Easel allows you to incorporate a WebComic using the WordPress Media Library functionality with Navigation into almost all WordPress themes. With just a few modifications of adding injection do_action locations into a theme, you can have the theme of your choice display and manage a webcomic. -Version: 1.10 +Version: 1.11 Author: Philip M. Hofer (Frumph) Author URI: http://frumph.net/ @@ -444,7 +444,8 @@ function ceo_load_options($reset = false) { 'enable_chapter_landing_first' => false, 'enable_blog_on_chapter_landing' => false, 'enable_comments_on_chapter_landing' => false, - 'default_nav_bar_chapter_goes_to_archive' => false + 'default_nav_bar_chapter_goes_to_archive' => false, + 'remove_post_thumbnail' => true ) as $field => $value) { $ceo_config[$field] = $value; } @@ -512,6 +513,11 @@ function ceo_pluginfo($whichinfo = null) { $ceo_options['default_nav_bar_chapter_goes_to_archive'] = false; update_option('comiceasel-config', $ceo_options); } + if (version_compare($ceo_options['db_version'], '1.9.7', '<')) { + $ceo_options['db_version'] = '1.9.7'; + $ceo_options['remove_post_thumbnail'] = true; + update_option('comiceasel-config', $ceo_options); + } $ceo_coreinfo = wp_upload_dir(); $ceo_addinfo = array( // if wp_upload_dir reports an error, capture it @@ -528,7 +534,7 @@ function ceo_pluginfo($whichinfo = null) { // comic-easel plugin directory/url 'plugin_url' => plugin_dir_url(__FILE__), 'plugin_path' => plugin_dir_path(__FILE__), - 'version' => '1.10' + 'version' => '1.11' ); // Combine em. $ceo_pluginfo = array_merge($ceo_pluginfo, $ceo_addinfo); diff --git a/functions/filters.php b/functions/filters.php index 9663358..a4faa5b 100644 --- a/functions/filters.php +++ b/functions/filters.php @@ -18,11 +18,12 @@ function ceo_init_filters() { add_filter('the_excerpt_rss','ceo_insert_comic_into_feed'); } - add_filter('request', 'ceo_rss_request'); // Add comics to the main RSS add_filter('request', 'ceo_post_type_tags_fix'); add_filter('previous_post_rel_link', 'ceo_change_prev_rel_link_two', $link); // change the rel links for comic pages add_filter('next_post_rel_link', 'ceo_change_next_rel_link_two', $link); +if (ceo_pluginfo('remove_post_thumbnail')) + add_filter('post_thumbnail_html','ceo_clear_post_thumbnail_on_comics'); function ceo_allow_my_post_types($allowed_post_types) { $allowed_post_types[] = 'comic'; @@ -143,3 +144,7 @@ function ceo_insert_comic_transcript_into_posts($content) { return $content; } +function ceo_clear_post_thumbnail_on_comics($content) { + global $post; + if ($post->post_type == 'comic') return ''; +} diff --git a/lang/comiceasel-en_US.mo b/lang/comiceasel-en_US.mo index 9f2dd044032c04b9f0515d5f4f4845e7cc33a2e8..5d6b84a148e3756d5ccd4d9022866ccb8ca704cc 100644 GIT binary patch delta 49 zcmbQvG@WTept>PffWK}~YFTD+W`3ToOJYf?m4cChp_#6sfv$n2f}y3Av5A$b<;05l E0A_X#{r~^~ delta 49 zcmbQvG@WTept=E9fWK}~YFTD+W`3ToOJYf?m4cChp_#6MrLM67kZEONXk}_Rv0^>| DW&{oG diff --git a/lang/comiceasel-en_US.po b/lang/comiceasel-en_US.po index 02e6f12..c0207d4 100644 --- a/lang/comiceasel-en_US.po +++ b/lang/comiceasel-en_US.po @@ -1,9 +1,9 @@ msgid "" msgstr "" -"Project-Id-Version: Comic Easel v1.10\n" +"Project-Id-Version: Comic Easel v1.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2016-09-30 20:41:51+0000\n" +"PO-Revision-Date: 2016-10-09 19:34:59+0000\n" "Last-Translator: frumph \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -21,7 +21,7 @@ msgstr "" "X-Textdomain-Support: yes" #: ceo-admin.php:43 -#: ceo-config.php:215 +#: ceo-config.php:216 #@ comiceasel msgid "Comic Easel" msgstr "" @@ -52,38 +52,38 @@ msgstr "" msgid "Comic Easel Settings RESET!" msgstr "" -#: ceo-config.php:158 +#: ceo-config.php:159 #@ comiceasel msgid "Comic Easel Settings SAVED!" msgstr "" -#: ceo-config.php:169 +#: ceo-config.php:170 #@ comiceasel msgid "General" msgstr "" -#: ceo-config.php:170 +#: ceo-config.php:171 #@ comiceasel msgid "Navigation" msgstr "" -#: ceo-config.php:171 +#: ceo-config.php:172 #@ comiceasel msgid "Archive" msgstr "" -#: ceo-config.php:175 +#: ceo-config.php:176 #: options/buycomic.php:11 #@ comiceasel msgid "Buy Comic" msgstr "" -#: ceo-config.php:215 +#: ceo-config.php:216 #@ comiceasel msgid "created, developed and maintained by" msgstr "" -#: ceo-config.php:216 +#: ceo-config.php:217 #@ comiceasel msgid "If you like the Comic Easel plugin, please donate. It will help in developing new features and versions." msgstr "" @@ -502,12 +502,12 @@ msgid "comic" msgstr "" #: comiceasel.php:435 -#: comiceasel.php:473 +#: comiceasel.php:474 #@ comiceasel msgid "*Additional shipping charges will applied at time of purchase." msgstr "" -#: comiceasel.php:554 +#: comiceasel.php:560 #@ comiceasel msgid "Comic Easel - Test Information" msgstr "" @@ -562,10 +562,10 @@ msgstr "" msgid "No thumbnail Found." msgstr "" -#: options/general.php:150 -#: options/general.php:168 -#: options/general.php:185 -#: options/general.php:202 +#: options/general.php:159 +#: options/general.php:177 +#: options/general.php:194 +#: options/general.php:211 #: widgets/scheduledcomics.php:38 #@ comiceasel msgid "None" @@ -1104,7 +1104,7 @@ msgstr "" #: options/archive.php:111 #: options/buycomic.php:99 -#: options/general.php:228 +#: options/general.php:237 #: options/landing.php:62 #: options/navigation.php:199 #@ comiceasel @@ -1292,46 +1292,46 @@ msgstr "" msgid "Select which chapter or (all) to display on the home page if you have different stories/chapters." msgstr "" -#: options/general.php:143 +#: options/general.php:152 #@ comiceasel msgid "Thumbnail sizes for locations where used." msgstr "" -#: options/general.php:148 +#: options/general.php:157 #@ comiceasel msgid "Thumbnail size for main RSS Feed" msgstr "" -#: options/general.php:157 -#: options/general.php:174 -#: options/general.php:191 -#: options/general.php:208 +#: options/general.php:166 +#: options/general.php:183 +#: options/general.php:200 +#: options/general.php:217 #: widgets/thumbnail.php:130 #@ comiceasel msgid "Full" msgstr "" -#: options/general.php:161 +#: options/general.php:170 #@ comiceasel msgid "The thumbnail for the main RSS /feed/" msgstr "" -#: options/general.php:166 +#: options/general.php:175 #@ comiceasel msgid "Thumbnail size for the direct comic & chapter RSS Feeds" msgstr "" -#: options/general.php:183 +#: options/general.php:192 #@ comiceasel msgid "Thumbnail size for archive and search" msgstr "" -#: options/general.php:195 +#: options/general.php:204 #@ comiceasel msgid "The thumbnail shown inside posts when viewed in the archive and search functions of WordPress" msgstr "" -#: options/general.php:217 +#: options/general.php:226 #@ comiceasel msgid "NOTE: Edit a post, click update on it for the feeds to refresh with new copies; to see changes." msgstr "" @@ -1835,12 +1835,12 @@ msgstr "" msgid "This date in history?" msgstr "" -#: ceo-config.php:168 +#: ceo-config.php:169 #@ comiceasel msgid "Main" msgstr "" -#: ceo-config.php:173 +#: ceo-config.php:174 #: options/landing.php:14 #@ comiceasel msgid "Landing Pages" @@ -2018,17 +2018,12 @@ msgstr "" msgid "Allow comics to associate with WordPress categories?" msgstr "" -#: options/general.php:100 -#@ comiceasel -msgid "For those people who need to allow comics associated with categories as well as chapters." -msgstr "" - -#: options/general.php:200 +#: options/general.php:209 #@ comiceasel msgid "Thumbnail size for Facebook images" msgstr "" -#: options/general.php:212 +#: options/general.php:221 #@ comiceasel msgid "Comic Easel adds an og:image to the head section of the site. This is the size of the image that is used for the image that facebook recognizes. If you are having issues where the image is not the one you want, flip this." msgstr "" @@ -2329,7 +2324,7 @@ msgstr "" msgid "This option disables the url line from interpreting numerical numbers as dates. ex. /comic/2014/" msgstr "" -#: options/general.php:178 +#: options/general.php:187 #@ comiceasel msgid "The thumbnail for the direct comic and chapter RSS /comic/feed/ and /chapter/chapter-slug/feed/" msgstr "" @@ -2354,3 +2349,18 @@ msgstr "" msgid "Image URL (for hotlinking/embedding):" msgstr "" +#: options/general.php:100 +#@ comiceasel +msgid "For those people who need to allow comics associated with categories as well as chapters. (might cause problems)" +msgstr "" + +#: options/general.php:139 +#@ comiceasel +msgid "Remove featured image in posts on non-ComicPress themes?" +msgstr "" + +#: options/general.php:144 +#@ comiceasel +msgid "Try to have Comic Easel automatically remove the featured image in posts on non-ComicPress themes?" +msgstr "" + diff --git a/options/general.php b/options/general.php index 1303b07..128f890 100644 --- a/options/general.php +++ b/options/general.php @@ -97,7 +97,7 @@ /> - + @@ -135,6 +135,15 @@ wp_dropdown_categories($args); + + + + /> + + + + +
diff --git a/readme.txt b/readme.txt index f26c29d..62f343f 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Author: Frumph Contributors: Frumph Tags: comiceasel, easel, webcomic, comic, webcomic Requires at least: 4.5 -Tested up to: 4.6 -Stable tag: 1.10 +Tested up to: 4.6.1 +Stable tag: 1.11 Donate link: http://frumph.net License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -128,6 +128,9 @@ The comic navigation widget is only seen if you have the comic sidebar's enabled == Changelog == += 1.11 = +* Add option to 'remove' featured images from comic posts on non-ComicPress themes automagically, if theme uses the function the_post_thumbnail() + = 1.10 = * Compatibility check with 4.6 diff --git a/widgets/archive-dropdown.php b/widgets/archive-dropdown.php index f683a61..c2d64ee 100644 --- a/widgets/archive-dropdown.php +++ b/widgets/archive-dropdown.php @@ -77,26 +77,20 @@ class ceo_walker_taxonomy_list extends Walker_Category { function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { $args['render_as_list'] = true; - ceo_taxonomy_walker_dropdown_or_list_start_el( $output, $category, $depth, $args, $id); + ceo_taxonomy_walker_dropdown_or_list_start_el( $output, $category, $depth = 0, $args, $id); } } class ceo_walker_taxonomy_dropdown extends Walker_CategoryDropdown { function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { $args['render_as_list'] = false; - ceo_taxonomy_walker_dropdown_or_list_start_el( $output, $category, $depth, $args, $id); + ceo_taxonomy_walker_dropdown_or_list_start_el( $output, $category, $depth = 0, $args, $id); } } -function ceo_comic_archive_jump_to_chapter($orderby = 0, $hide = true, $exclude = '', $showcount = false, $jumptoarchive = false, $echo = true, $render_as_list = false) { +function ceo_comic_archive_jump_to_chapter($hide = true, $exclude = '', $showcount = false, $jumptoarchive = false, $echo = true, $render_as_list = false) { ceo_protect(); - if ($orderby == 2) { - $orderby = 'ID'; - } else if ($orderby == 1) { - $orderby = 'tax_name'; - } else { - $orderby = 'menu_order'; - } + $output = ''; if ($render_as_list) { global $post; @@ -104,7 +98,7 @@ function ceo_comic_archive_jump_to_chapter($orderby = 0, $hide = true, $exclude // echo "
the terms ";print_r($the_terms); echo "
"; $args = array( 'walker' => new ceo_walker_taxonomy_list(), - 'orderby' => ''.$orderby.'', + 'orderby' => 'menu_order', 'order' => 'ASC', 'show_count' => $showcount, 'hide_empty' => $hide, @@ -126,7 +120,7 @@ function ceo_comic_archive_jump_to_chapter($orderby = 0, $hide = true, $exclude 'walker' => new ceo_walker_taxonomy_dropdown(), 'show_option_all' => __('Select','comiceasel').' '.ucwords(ceo_pluginfo('chapter_type_slug_name')), 'option_none_value' => '-1', - 'orderby' => ''.$orderby.'', + 'orderby' => 'menu_order', 'order' => 'ASC', 'name' => ceo_pluginfo('chapter_type_slug_name'), 'show_count' => $showcount, @@ -174,10 +168,9 @@ class ceo_comic_archive_dropdown_widget extends WP_Widget { echo $before_widget; $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; - if (!isset($instance['orderby'])) $instance['orderby'] = 0; if (!isset($instance['hide'])) $instance['hide'] = 1; if (!isset($instance['render_as_list'])) $instance['render_as_list'] = false; - ceo_comic_archive_jump_to_chapter($instance['orderby'], $instance['hide'], $instance['exclude'], $instance['showcount'], $instance['jumptoarchive'], true, $instance['render_as_list']); + ceo_comic_archive_jump_to_chapter($instance['hide'], $instance['exclude'], $instance['showcount'], $instance['jumptoarchive'], true, $instance['render_as_list']); echo $after_widget; } @@ -185,7 +178,6 @@ class ceo_comic_archive_dropdown_widget extends WP_Widget { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['exclude'] = strip_tags($new_instance['exclude']); - $instance['orderby'] = $new_instance['orderby']; $instance['hide'] = ($new_instance['hide']) ? 1:0; $instance['showcount'] = ($new_instance['showcount']) ? 1:0; $instance['jumptoarchive'] = ($new_instance['jumptoarchive']) ? 1:0; @@ -194,10 +186,9 @@ class ceo_comic_archive_dropdown_widget extends WP_Widget { } function form($instance) { - $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'exclude' => '', 'orderby' => 0, 'hide' => 1, 'showcount' => 1, 'jumptoarchive' => 0, 'render_as_list' => 0) ); + $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'exclude' => '', 'hide' => 1, 'showcount' => 1, 'jumptoarchive' => 0, 'render_as_list' => 0) ); $title = $instance['title']; $exclude = $instance['exclude']; - $orderby = $instance['orderby']; $hide = ($instance['hide']) ? 1:0; $showcount = ($instance['showcount']) ? 1:0; $jumptoarchive = ($instance['jumptoarchive']) ? 1:0; @@ -205,11 +196,6 @@ class ceo_comic_archive_dropdown_widget extends WP_Widget { ?>


-