Adjustments to the navigation to work on home page with first comic (hopefully)

This commit is contained in:
Frumph
2013-03-30 16:59:59 -07:00
parent 960c27c5f0
commit b7ca9316ad
8 changed files with 32 additions and 19 deletions
+4 -2
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.1
Version: 1.2
Author: Philip M. Hofer (Frumph)
Author URI: http://frumph.net/
@@ -300,7 +300,8 @@ function ceo_load_options($reset = false) {
'include_comics_in_blog_archive' => false,
'disable_related_comics' => false,
'custom_post_type_slug_name' => 'comic',
'display_first_comic_on_home_page' => false
'display_first_comic_on_home_page' => false,
'disable_style_sheet' => false
) as $field => $value) {
$ceo_config[$field] = $value;
}
@@ -321,6 +322,7 @@ function ceo_pluginfo($whichinfo = null) {
ceo_chapters_activate();
$ceo_options['db_version'] = '1.1';
$ceo_options['display_first_comic_on_home_page'] = false;
$ceo_options['disable_style_sheet'] = false;
update_option('comiceasel-config', $ceo_options);
}
if (!isset($ceo_options['custom_post_type_slug_name']) || empty($ceo_options['custom_post_type_slug_name'])) $ceo_options['custom_post_type_slug_name'] == 'comic';
-1
View File
@@ -90,7 +90,6 @@ function ceo_display_comic_area() {
$wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query($comic_args);
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
ceo_display_comic_wrapper();
break;
endwhile;
ceo_UnProtect();
}
+1
View File
@@ -4,6 +4,7 @@
*/
function ceo_get_sidebar($location = '') {
global $post;
if (!empty($location)) do_action($location.'-top');
if (file_exists(get_stylesheet_directory().'/sidebar-'.$location.'.php')) {
get_sidebar($location);
+1 -4
View File
@@ -22,7 +22,6 @@ function ceo_get_first_comic_in_chapter_permalink() {
}
function ceo_get_last_comic($in_chapter = false) {
global $post;
$current_chapter = get_the_terms( $post->ID, 'chapters');
$current_chapter_id = 0;
if (is_array($current_chapter) && $in_chapter) {
@@ -129,7 +128,6 @@ function ceo_get_terminal_post_of_chapter($chapterID = 0, $first = true) {
*/
function ceo_get_adjacent_comic($previous = true, $in_same_chapter = false, $taxonomy = 'comic') {
global $post, $wpdb;
if ( empty( $post ) ) return null;
$current_post_date = $post->post_date;
@@ -154,7 +152,7 @@ function ceo_get_adjacent_comic($previous = true, $in_same_chapter = false, $tax
$sort = apply_filters( "get_{$adjacent}_{$taxonomy}_sort", "ORDER BY p.post_date $order LIMIT 1" );
$query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort";
$query_key = "adjacent_{$taxonomy}_" . md5($query);
$query_key = "adjacent_{$taxonomy}_{$post->ID}_{$previous}_{$in_same_chapter}"; // . md5($query);
$result = wp_cache_get($query_key, 'counts');
if ( false !== $result )
return $result;
@@ -162,7 +160,6 @@ function ceo_get_adjacent_comic($previous = true, $in_same_chapter = false, $tax
$result = $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");
if ( null === $result )
$result = '';
wp_cache_set($query_key, $result, 'counts');
return $result;
}
+1
View File
@@ -8,6 +8,7 @@ if ( isset( $_GET['random'] ) )
//to use simply create a URL link to "/?latestcomic"
function ceo_latest_comic_jump() {
$chapter = 0;
if (isset($_GET['latest'])) $chapter = (int)esc_attr($_GET['latest']);
if (!empty($chapter)) {
$this_chapter = get_term_by('term_id', $chapter, 'chapters');
+10 -1
View File
@@ -70,7 +70,16 @@
<td>
<?php _e('Enabling this will make it so that the comic on the home page is the first comic.','comiceasel'); ?>
</td>
</tr>
</tr>
<tr>
<th scope="row"><label for="disable_style_sheet"><?php _e('Disable the default stylesheets. comiceasel.css and navstyle.css','comiceasel'); ?></label></th>
<td>
<input id="disable_style_sheet" name="disable_style_sheet" type="checkbox" value="1" <?php checked(true, $ceo_options['disable_style_sheet']); ?> />
</td>
<td>
<?php _e('Checkmarking this will make it so that the default stylesheets do not load, you would need to add those css elements yourself to your style.css','comiceasel'); ?>
</td>
</tr>
</table>
<br />
<table class="widefat">
+5 -1
View File
@@ -3,7 +3,7 @@ Contributors: frumph
Tags: comiceasel, easel, webcomic, comic, webcomic
Requires at least: 3.2
Tested up to: 3.5
Stable tag: 1.1
Stable tag: 1.2
Donate link: http://frumph.net
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -125,6 +125,10 @@ The comic navigation widget is only seen if you have the comic sidebar's enabled
== Changelog ==
= 1.2 =
Attempt at a navigation fix for the widget for front page ASC/DESC changes
Also fixed (hopefully) the name change after saving the widget
= 1.1 =
Added option to allow making the first comic appear on the home page
the comic's blog post now will search for content-comic.php in the theme/child themes directory and use that if it exists
+10 -10
View File
@@ -162,22 +162,22 @@ class ceo_comic_navigation_widget extends WP_Widget {
}
function widget($args, $instance) {
global $wp_query, $post;
global $post;
if (is_home() || is_front_page()) {
ceo_Protect();
$order = (ceo_pluginfo('display_first_comic_on_home_page')) ? 'asc' : 'desc';
$comic_args = array(
'showposts' => 1,
'posts_per_page' => 1,
'post_type' => 'comic'
'post_type' => 'comic',
'order' => $order
);
$posts = get_posts($comic_args);
foreach ($posts as $post) {
$wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query($comic_args);
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
$this->display_comic_nav_wrapper($args, $instance);
}
ceo_UnProtect();
} else {
endwhile;
} else {
$this->display_comic_nav_wrapper($args, $instance);
}
}
}
function update($new_instance, $old_instance) {
@@ -267,7 +267,7 @@ class ceo_comic_navigation_widget extends WP_Widget {
<br />
<input id="<?php echo $this->get_field_id('previous'); ?>" name="<?php echo $this->get_field_name('previous'); ?>" type="checkbox" value="1" <?php checked(true, $instance['previous']); ?> /> <label for="<?php echo $this->get_field_id('previous'); ?>"><strong><?php _e('Previous','comiceasel'); ?></strong></label>
<input class="widefat" id="<?php echo $this->get_field_id('first_title'); ?>" name="<?php echo $this->get_field_name('previous_title'); ?>" type="text" value="<?php echo stripcslashes($instance['previous_title']); ?>" /></label><br />
<input class="widefat" id="<?php echo $this->get_field_id('previous_title'); ?>" name="<?php echo $this->get_field_name('previous_title'); ?>" type="text" value="<?php echo stripcslashes($instance['previous_title']); ?>" /></label><br />
<br />
<input id="<?php echo $this->get_field_id('next'); ?>" name="<?php echo $this->get_field_name('next'); ?>" type="checkbox" value="1" <?php checked(true, $instance['next']); ?> /> <label for="<?php echo $this->get_field_id('next'); ?>"><strong><?php _e('Next','comiceasel'); ?></strong></label>