Introducing John Bintz's protect and restore functions, moved the #comic code from index & single into the layout-head so that it's uniformative code but made it call display_comic_area(); made it so that left and right sidebar's will know the comic code on index, etc. temporarily added the queries to the footer.php and re-enabled (orig) navigation for testing.
Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
parent
40295c662a
commit
b0ad9bec80
|
@ -35,7 +35,7 @@
|
||||||
<span class="footer-pipe">|</span>
|
<span class="footer-pipe">|</span>
|
||||||
<a href="#outside" onclick="scrollup(); return false;"><?php _e('Back to Top ↑','comicpress'); ?></a>
|
<a href="#outside" onclick="scrollup(); return false;"><?php _e('Back to Top ↑','comicpress'); ?></a>
|
||||||
</span>
|
</span>
|
||||||
<!-- <?php echo get_num_queries() ?> queries. <?php timer_stop(1) ?> seconds. -->
|
<br /><?php echo get_num_queries() ?> queries. <?php timer_stop(1) ?> seconds.
|
||||||
</p>
|
</p>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Display Comic
|
function display_comic_area() {
|
||||||
* Displays the comic.
|
global $comicpress_options;
|
||||||
*
|
if (comicpress_check_child_file('partials/displaycomic') == false) { ?>
|
||||||
*
|
<div id="comic-wrap">
|
||||||
*/
|
<div id="comic-head"><?php get_sidebar('over'); ?></div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
<?php get_sidebar('comicleft'); ?>
|
||||||
|
<div id="comic"><?php display_comic(); ?></div>
|
||||||
|
<?php get_sidebar('comicright'); ?>
|
||||||
|
<div class="clear"></div>
|
||||||
|
<div id="comic-foot"><?php get_sidebar('under'); ?></div>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
}
|
||||||
|
|
||||||
function display_comic() {
|
function display_comic() {
|
||||||
global $post, $wp_query, $rascal_says, $comicpress_options, $comic_filename_filters;
|
global $post, $wp_query, $rascal_says, $comicpress_options, $comic_filename_filters;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function display_comic_post() {
|
function display_comic_post($frontpage = 0) {
|
||||||
global $post, $wp_query, $authordata, $comicpress_options, $archive_comic_width;;
|
global $post, $wp_query, $authordata, $comicpress_options, $archive_comic_width;
|
||||||
$first_comic = get_first_comic_permalink();
|
$first_comic = get_first_comic_permalink();
|
||||||
$last_comic = get_last_comic_permalink();
|
$last_comic = get_last_comic_permalink();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protect global $post and $wp_query.
|
||||||
|
* @param object $use_this_post If provided, after saving the current post, set up this post for template tag use.
|
||||||
|
*/
|
||||||
|
function Protect($use_this_post = null) {
|
||||||
|
global $post, $wp_query, $__post, $__wp_query;
|
||||||
|
|
||||||
|
$__post = $post;
|
||||||
|
$__wp_query = $wp_query;
|
||||||
|
|
||||||
|
if (!is_null($use_this_post)) {
|
||||||
|
$post = $use_this_post;
|
||||||
|
setup_postdata($post);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporarily restore the global $post variable and set it up for use.
|
||||||
|
*/
|
||||||
|
function Restore() {
|
||||||
|
global $post, $__post;
|
||||||
|
|
||||||
|
$post = $__post;
|
||||||
|
setup_postdata($post);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore global $post and $wp_query.
|
||||||
|
*/
|
||||||
|
function Unprotect() {
|
||||||
|
global $post, $wp_query, $__post, $__wp_query;
|
||||||
|
|
||||||
|
$post = $__post;
|
||||||
|
$wp_query = $__wp_query;
|
||||||
|
|
||||||
|
$__post = $__wp_query = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
78
index.php
78
index.php
|
@ -1,68 +1,19 @@
|
||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
<div id="content-wrapper-head"></div>
|
<?php include(get_template_directory() . '/layout-head.php'); ?>
|
||||||
<div id="content-wrapper">
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('gn,v3c')) get_sidebar('left'); ?>
|
<?php if (!$comicpress_options['disable_comic_frontpage'] && !$comicpress_options['disable_comic_blog_frontpage'] && !is_paged() ) {
|
||||||
|
Protect();
|
||||||
<?php if (is_cp_theme_layout('gn,rgn')) { ?>
|
$comic_query = '&showposts=1&cat='.get_all_comic_categories_as_cat_string();
|
||||||
<div id="pagewrap-right">
|
$posts = query_posts($comic_query);
|
||||||
<?php } ?>
|
$wp_query->is_archive = false;
|
||||||
|
if (have_posts()) {
|
||||||
<?php if (is_cp_theme_layout('v3cr')) { ?>
|
while (have_posts()) : the_post();
|
||||||
<div id="pagewrap-left">
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('v3c,v')) { ?>
|
|
||||||
<div id="content" class="narrowcolumn">
|
|
||||||
<div class="column">
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (!(is_paged())) { ?>
|
|
||||||
|
|
||||||
<?php if (!$comicpress_options['disable_comic_frontpage']) { ?>
|
|
||||||
<?php $wp_query ->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query('showposts=1&cat='.get_all_comic_categories_as_cat_string());
|
|
||||||
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post() ?>
|
|
||||||
<?php if (comicpress_check_child_file('partials/displaycomic') == false) { ?>
|
|
||||||
<div id="comic-wrap">
|
|
||||||
<div id="comic-head"><?php get_sidebar('over'); ?></div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
<?php get_sidebar('comicleft'); ?>
|
|
||||||
<div id="comic"><?php display_comic(); ?></div>
|
|
||||||
<?php get_sidebar('comicright'); ?>
|
|
||||||
<div class="clear"></div>
|
|
||||||
<div id="comic-foot"><?php get_sidebar('under'); ?></div>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
<?php endwhile; ?>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('3c,standard,3c2r')) { ?>
|
|
||||||
<div id="subcontent-wrapper-head"></div>
|
|
||||||
<div id="subcontent-wrapper">
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php get_sidebar('overblog'); ?>
|
|
||||||
<?php if (is_cp_theme_layout('3c,rgn')) get_sidebar('left'); ?>
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('v3cr')) { ?>
|
|
||||||
<div id="subcontent-wrapper-head"></div>
|
|
||||||
<div id="subcontent-wrapper">
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (!is_cp_theme_layout('v3c,v')) { ?>
|
|
||||||
<div id="content" class="narrowcolumn">
|
|
||||||
<div class="column">
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (!$comicpress_options['disable_comic_frontpage'] && !$comicpress_options['disable_comic_blog_frontpage'] && !is_paged() ) { ?>
|
|
||||||
<?php while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
|
|
||||||
display_comic_post();
|
display_comic_post();
|
||||||
$comicFrontPage->is_single = true;
|
|
||||||
comments_template();
|
comments_template();
|
||||||
endwhile; ?>
|
endwhile;
|
||||||
|
}
|
||||||
|
Restore();
|
||||||
|
UnProtect(); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if (function_exists('the_project_wonderful_ad')) { ?>
|
<?php if (function_exists('the_project_wonderful_ad')) { ?>
|
||||||
|
@ -81,6 +32,7 @@
|
||||||
|
|
||||||
<?php if (!$comicpress_options[disable_blog_frontpage]) {
|
<?php if (!$comicpress_options[disable_blog_frontpage]) {
|
||||||
global $blog_postcount;
|
global $blog_postcount;
|
||||||
|
Protect();
|
||||||
if (!$comicpress_options['split_column_in_two']) {
|
if (!$comicpress_options['split_column_in_two']) {
|
||||||
$blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&paged='.$paged;
|
$blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&paged='.$paged;
|
||||||
|
|
||||||
|
@ -99,7 +51,9 @@
|
||||||
comicpress_pagination();
|
comicpress_pagination();
|
||||||
} else {
|
} else {
|
||||||
comicpress_dual_columns();
|
comicpress_dual_columns();
|
||||||
}
|
}
|
||||||
|
Restore();
|
||||||
|
UnProtect();
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
<?php get_sidebar('underblog'); ?>
|
<?php get_sidebar('underblog'); ?>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<?php global $comicpress_options; ?>
|
||||||
<?php if (comicpress_check_child_file('layout-head') == false) { ?>
|
<?php if (comicpress_check_child_file('layout-head') == false) { ?>
|
||||||
|
|
||||||
<div id="content-wrapper-head"></div>
|
<div id="content-wrapper-head"></div>
|
||||||
|
@ -13,6 +14,25 @@
|
||||||
<div id="pagewrap-left">
|
<div id="pagewrap-left">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
Protect();
|
||||||
|
if (!$comicpress_options['disable_comic_frontpage'] && is_home()) {
|
||||||
|
$comic_query = 'showposts=1&cat='.get_all_comic_categories_as_cat_string();
|
||||||
|
$posts = query_posts($comic_query);
|
||||||
|
if (have_posts()) {
|
||||||
|
while (have_posts()) : the_post();
|
||||||
|
$wp_query->is_single = true;
|
||||||
|
display_comic_area();
|
||||||
|
endwhile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Restore();
|
||||||
|
UnProtect();
|
||||||
|
if (is_single() & in_comic_category()) {
|
||||||
|
display_comic_area();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('3c,standard,3c2r')) { ?>
|
<?php if (is_cp_theme_layout('3c,standard,3c2r')) { ?>
|
||||||
<div id="subcontent-wrapper-head"></div>
|
<div id="subcontent-wrapper-head"></div>
|
||||||
<div id="subcontent-wrapper">
|
<div id="subcontent-wrapper">
|
||||||
|
|
83
single.php
83
single.php
|
@ -1,70 +1,23 @@
|
||||||
<?php get_header(); global $comicpress_options; ?>
|
<?php get_header(); ?>
|
||||||
<div id="content-wrapper-head"></div>
|
<?php include(get_template_directory() . '/layout-head.php'); ?>
|
||||||
<div id="content-wrapper">
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('gn,v3c')) get_sidebar('left'); ?>
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('gn,rgn')) { ?>
|
|
||||||
<div id="pagewrap-right">
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('v3cr')) { ?>
|
|
||||||
<div id="pagewrap-left">
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('v3c,v')) { ?>
|
|
||||||
<div id="content" class="narrowcolumn">
|
|
||||||
<div class="column">
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php while (have_posts()) : the_post();
|
|
||||||
if (in_comic_category()) { ?>
|
|
||||||
<?php if (comicpress_check_child_file('partials/displaycomic') == false) { ?>
|
|
||||||
<div id="comic-wrap">
|
|
||||||
<div id="comic-head"><?php get_sidebar('over'); ?></div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
<?php get_sidebar('comicleft'); ?>
|
|
||||||
<div id="comic"><?php display_comic(); ?></div>
|
|
||||||
<?php get_sidebar('comicright'); ?>
|
|
||||||
<div class="clear"></div>
|
|
||||||
<div id="comic-foot"><?php get_sidebar('under'); ?></div>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
<?php } endwhile; ?>
|
|
||||||
|
|
||||||
<?php if (is_cp_theme_layout('3c,standard,3c2r')) { ?>
|
<?php
|
||||||
<div id="subcontent-wrapper-head"></div>
|
if (have_posts()) : while (have_posts()) : the_post();
|
||||||
<div id="subcontent-wrapper">
|
if (in_comic_category()) {
|
||||||
<?php } ?>
|
if (!$comicpress_options['disable_comic_blog_single']) {
|
||||||
|
display_comic_post();
|
||||||
<?php get_sidebar('overblog'); ?>
|
$cur_date = mysql2date('Y-m-j', $post->post_date);
|
||||||
<?php if (is_cp_theme_layout('3c,rgn')) get_sidebar('left'); ?>
|
$next_comic = get_next_comic();
|
||||||
|
$next_comic = (array)$next_comic;
|
||||||
<?php if (is_cp_theme_layout('v3cr')) { ?>
|
$next_date = mysql2date('Y-m-j', $next_comic['post_date']);
|
||||||
<div id="subcontent-wrapper-head"></div>
|
$blog_query = 'showposts='.$blog_postcount.'&order=asc&cat=-'.exclude_comic_categories();
|
||||||
<div id="subcontent-wrapper">
|
}
|
||||||
<?php } ?>
|
} else {
|
||||||
|
display_blog_post();
|
||||||
<?php if (!is_cp_theme_layout('v3c,v')) { ?>
|
}
|
||||||
<div id="content" class="narrowcolumn">
|
endwhile;
|
||||||
<div class="column">
|
?>
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if (have_posts()) : while (have_posts()) : the_post();
|
|
||||||
if (in_comic_category()) {
|
|
||||||
if (!$comicpress_options['disable_comic_blog_single']) {
|
|
||||||
display_comic_post();
|
|
||||||
$cur_date = mysql2date('Y-m-j', $post->post_date);
|
|
||||||
$next_comic = get_next_comic();
|
|
||||||
$next_comic = (array)$next_comic;
|
|
||||||
$next_date = mysql2date('Y-m-j', $next_comic['post_date']);
|
|
||||||
$blog_query = 'showposts='.$blog_postcount.'&order=asc&cat=-'.exclude_comic_categories();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
display_blog_post();
|
|
||||||
}
|
|
||||||
endwhile;
|
|
||||||
?>
|
|
||||||
<?php if (function_exists('the_project_wonderful_ad')) { ?>
|
<?php if (function_exists('the_project_wonderful_ad')) { ?>
|
||||||
<div class="blogpwad">
|
<div class="blogpwad">
|
||||||
<center>
|
<center>
|
||||||
|
|
|
@ -20,14 +20,13 @@ class ComicPressComicBlogPostWidget extends WP_Widget {
|
||||||
|
|
||||||
function widget($args, $instance) {
|
function widget($args, $instance) {
|
||||||
global $post, $wp_query;
|
global $post, $wp_query;
|
||||||
if (is_home() || is_single()) {
|
if ((is_home() || is_single()) && in_comic_category()) {
|
||||||
extract($args, EXTR_SKIP);
|
extract($args, EXTR_SKIP);
|
||||||
if (!empty($post->post_content)) {
|
if (!empty($post->post_content)) {
|
||||||
echo $before_widget;
|
echo $before_widget;
|
||||||
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
|
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
|
||||||
if ( !empty( $title ) ) { echo '<div class="heading">'.$title.'</div>'; }
|
if ( !empty( $title ) ) { echo '<div class="heading">'.$title.'</div>'; }
|
||||||
|
echo $post->post_content;
|
||||||
display_comic_post();
|
|
||||||
echo $after_widget;
|
echo $after_widget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class widget_comicpress_graphical_navigation extends WP_Widget {
|
||||||
function widget($args, $instance) {
|
function widget($args, $instance) {
|
||||||
global $wp_query, $post;
|
global $wp_query, $post;
|
||||||
|
|
||||||
if (is_home() || is_single()) {
|
// if (is_home() || is_single()) {
|
||||||
|
|
||||||
$this_permalink = get_permalink();
|
$this_permalink = get_permalink();
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class widget_comicpress_graphical_navigation extends WP_Widget {
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php }
|
<?php // }
|
||||||
}
|
}
|
||||||
|
|
||||||
function update($new_instance, $old_instance) {
|
function update($new_instance, $old_instance) {
|
||||||
|
@ -273,13 +273,13 @@ class widget_comicpress_graphical_navigation extends WP_Widget {
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// register_widget('widget_comicpress_graphical_navigation');
|
register_widget('widget_comicpress_graphical_navigation');
|
||||||
|
|
||||||
|
|
||||||
function widget_comicpress_graphical_navigation_init() {
|
function widget_comicpress_graphical_navigation_init() {
|
||||||
new widget_comicpress_graphical_navigation();
|
new widget_comicpress_graphical_navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// add_action('widgets_init', 'widget_comicpress_graphical_navigation_init');
|
add_action('widgets_init', 'widget_comicpress_graphical_navigation_init');
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue