In-Chapter (prev/next) navigates to next chapter with option enabled - added filter columns to the comic -> (all) comics section

This commit is contained in:
Frumph
2013-09-07 15:41:35 -07:00
parent 09a7f44efa
commit 1bbcbf5545
8 changed files with 87 additions and 10 deletions

View File

@@ -69,7 +69,8 @@ if ( isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'update-op
'enable_embed_nav',
'disable_default_nav',
'disable_mininav',
'enable_chapter_only_random'
'enable_chapter_only_random',
'enable_prevnext_chapter_traversing'
) as $key) {
if (!isset($_REQUEST[$key])) $_REQUEST[$key] = 0;
$ceo_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );

View File

@@ -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.5.2
Version: 1.5.3
Author: Philip M. Hofer (Frumph)
Author URI: http://frumph.net/
@@ -372,7 +372,8 @@ function ceo_load_options($reset = false) {
'buy_comic_print_amount' => '25.00',
'buy_comic_sell_original' => true,
'buy_comic_orig_amount' => '65.00',
'buy_comic_text' => __('*Additional shipping charges will applied at time of purchase.','comiceasel')
'buy_comic_text' => __('*Additional shipping charges will applied at time of purchase.','comiceasel'),
'enable_prevnext_chapter_traversing' => false
) as $field => $value) {
$ceo_config[$field] = $value;
}
@@ -417,13 +418,14 @@ function ceo_pluginfo($whichinfo = null) {
// comic-easel plugin directory/url
'plugin_url' => plugin_dir_url(__FILE__),
'plugin_path' => plugin_dir_path(__FILE__),
'version' => '1.5'
'version' => '1.5.3'
);
// Combine em.
$ceo_pluginfo = array_merge($ceo_pluginfo, $ceo_addinfo);
$ceo_pluginfo = array_merge($ceo_pluginfo, $ceo_options);
if (!isset($ceo_pluginfo['disable_style_sheet'])) $ceo_pluginfo['disable_style_sheet'] = false;
if (!isset($ceo_pluginfo['enable_transcripts_in_comic_posts'])) $ceo_pluginfo['enable_transcripts_in_comic_posts'] = false;
if (!isset($ceo_pluginfo['enable_prevnext_chapter_traversing'])) $ceo_pluginfo['enable_prevnext_chapter_traversing'] = false;
}
if ($whichinfo) {
if (isset($ceo_pluginfo[$whichinfo])) {

View File

@@ -98,8 +98,6 @@ table#comic-nav-wrapper {
color: #ffcf00;
}
#comic img {
margin: 0;
padding: 0;

View File

@@ -20,6 +20,10 @@ function ceo_admin_init() {
add_action('create_term', 'ceo_chapters_add_edit_menu_order');
// add_filter('get_terms_args', 'ceo_chapters_find_menu_orderby');
add_action( 'restrict_manage_posts', 'ceo_filter_restrict_manage_posts' );
add_filter( 'parse_query', 'ceo_taxonomy_filter_post_type_request' );
}
function ceo_chapters_add_edit_menu_order($term_id) {
@@ -157,6 +161,46 @@ function ceo_manage_comic_columns($column_name, $id) {
} // end switch
}
// Filter the request to just give posts for the given taxonomy, if applicable.
function ceo_filter_restrict_manage_posts() {
global $typenow;
if ('comic' == $typenow) {
$post_types = get_post_types( array( '_builtin' => false ) );
if ( in_array( $typenow, $post_types ) ) {
$filters = get_object_taxonomies( $typenow );
// remove post tag
$filters = array_diff($filters, array('post_tag'));
foreach ( $filters as $tax_slug ) {
$tax_obj = get_taxonomy( $tax_slug );
wp_dropdown_categories( array(
'show_option_all' => __('Show All '.$tax_obj->label ),
'taxonomy' => $tax_slug,
'name' => $tax_obj->name,
'orderby' => 'name',
'selected' => (isset($_GET[$tax_slug])) ? $_GET[$tax_slug] : '',
'hierarchical' => $tax_obj->hierarchical,
'show_count' => false,
'hide_empty' => true
) );
}
}
}
}
function ceo_taxonomy_filter_post_type_request( $query ) {
global $pagenow, $typenow;
if ( 'edit.php' == $pagenow ) {
$filters = get_object_taxonomies( $typenow );
foreach ( $filters as $tax_slug ) {
$var = &$query->query_vars[$tax_slug];
if ( isset( $var ) ) {
$term = get_term_by( 'id', $var, $tax_slug );
if (!empty($term)) $var = $term->slug;
}
}
}
}
function ceo_edit_select_motion_artist_directory_in_post($post) {
$current_directory = get_post_meta( $post->ID, 'ma-directory', true );

View File

@@ -140,12 +140,13 @@ function ceo_display_comic_gallery($size = 'full') {
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' => $post_image_id
'exclude' => array($post->ID)
);
$output .= gallery_shortcode($args);
}
@@ -164,6 +165,7 @@ function ceo_display_flash_comic($post, $flash_url) {
$output .= ' <object type="application/x-shockwave-flash" data="'.$flash_url.'" width="'.$width.'" height="'.$height.'">'."\r\n";
$output .= ' <param name="movie" value="'.$flash_url.'"/>'."\r\n";
$output .= ' <!--<![endif]-->'."\r\n";
$output .= ceo_display_featured_image_comic('full');
$output .= ' <a href="http://www.adobe.com/go/getflash">'."\r\n";
$output .= ' <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>'."\r\n";
$output .= ' </a>'."\r\n";

View File

@@ -59,6 +59,14 @@ function ceo_get_previous_comic_in_chapter_permalink() {
if (is_object($prev_comic) && isset($prev_comic->ID)) {
return get_permalink($prev_comic->ID);
}
// Go to last comic of previous chapter if possible.
if (ceo_pluginfo('enable_prevnext_chapter_traversing')) {
$chapter = ceo_get_adjacent_chapter(true);
if (is_object($chapter)) {
$terminal = ceo_get_terminal_post_of_chapter($chapter->term_id, false);
return !empty($terminal) ? get_permalink($terminal->ID) : false;
}
}
return false;
}
@@ -79,6 +87,14 @@ function ceo_get_next_comic_in_chapter_permalink() {
if (is_object($next_comic) && isset($next_comic->ID)) {
return get_permalink($next_comic->ID);
}
// go to first comic of next chapter if possible
if (ceo_pluginfo('enable_prevnext_chapter_traversing')) {
$chapter = ceo_get_adjacent_chapter(false);
if (is_object($chapter)) {
$terminal = ceo_get_terminal_post_of_chapter($chapter->term_id, true);
return !empty($terminal) ? get_permalink($terminal->ID) : false;
}
}
return false;
}

View File

@@ -39,6 +39,16 @@
<?php _e('Make the random button only jump to the comics within the same chapter?','comiceasel'); ?>
</td>
</tr>
<tr class="alternate">
<?php if (!isset($ceo_options['enable_prevnext_chapter_traversing'])) $ceo_options['enable_prevnext_chapter_traversing'] = false; ?>
<th scope="row"><label for="enable_prevnext_chapter_traversing"><?php _e('Traverse comic chapters with the previous/next?','comiceasel'); ?></label></th>
<td>
<input id="enable_prevnext_chapter_traversing" name="enable_prevnext_chapter_traversing" type="checkbox" value="1" <?php checked(true, $ceo_options['enable_prevnext_chapter_traversing']); ?> />
</td>
<td>
<?php _e('If at the first or last comic in a chapter, have the previous and next (in chapter) buttons navigate to the beginning or end of the connected in order chapters?','comiceasel'); ?>
</td>
</tr>
</table>
<br />
<table class="widefat">

View File

@@ -3,7 +3,7 @@ Contributors: Frumph
Tags: comiceasel, easel, webcomic, comic, webcomic
Requires at least: 3.2
Tested up to: 3.6
Stable tag: 1.5.2
Stable tag: 1.5.3
Donate link: http://frumph.net
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -126,11 +126,15 @@ The comic navigation widget is only seen if you have the comic sidebar's enabled
== Changelog ==
= 1.5.3 =
* Traverse comic chapters with the previous/next buttons (option) in navigation tab.
* Added filter by columns on the comic - (all) comics page.
= 1.5.2 =
Welcome back flash comics.
* Welcome back flash comics.
= 1.5.1 =
Fixed a bunch of extra /slashes that were after plugin_path and plugin_url - thanks Eric Merced
* Fixed a bunch of extra /slashes that were after plugin_path and plugin_url - thanks Eric Merced
= 1.5 =
* Buy Print/Original shortcode & buttons with IPN to Paypal