functions.php and other code-related changes

This commit is contained in:
John Bintz 2009-07-17 16:34:22 -04:00
parent cac287bc5d
commit f6f459ed85
8 changed files with 332 additions and 296 deletions

View File

@ -1,6 +1,6 @@
<?php get_header() ?> <?php get_header() ?>
<div id="content" class="archive"> <div id="content" class="narrowcolumn">
<?php if (have_posts()) : ?> <?php if (have_posts()) : ?>
@ -93,6 +93,6 @@
</div> </div>
<?php include(TEMPLATEPATH . '/sidebar.php') ?> <?php get_sidebar(); ?>
<?php get_footer() ?> <?php get_footer() ?>

View File

@ -0,0 +1,49 @@
<?php
function comic_navigation() {
global $post, $wp_query;
$temppost = $post;
$temp_query = $wp_query;
$temp_single = $wp_query->is_single;
echo '<div id="comic_navi_wrapper">';
echo ' <div id="comic_navi_prev">';
$first_comic = get_first_comic_permalink();
if ($first_comic != get_permalink()) {
echo ' <a href="'.$first_comic.'" class="rollfirst" title="First">&nbsp;</a>';
} else {
echo ' <img src="'.get_bloginfo('stylesheet_directory').'/images/disabled_firstroll.png" alt="At First" style="float:left;" class="disabled_navi" />';
}
$wp_query->is_single = true;
$prev_comic = get_permalink(get_adjacent_post(true, '', true));
if (!empty($prev_comic) && (get_permalink() != $first_comic)) {
echo ' <a href="'.$prev_comic.'" class="rollprev" title="Previous">&nbsp;</a>';
} else {
echo ' <img src="'.get_bloginfo('stylesheet_directory').'/images/disabled_prevroll.png" alt="No Previous" style="float:left;" class="disabled_navi" />';
}
$wp_query->is_single = $temp_single;
echo ' </div>';
echo ' <div id="comic_navi_next">';
$last_comic = get_last_comic_permalink();
if ($last_comic != get_permalink()) {
echo ' <a href="/" class="rolllast" title="Last">&nbsp;</a>';
} else {
echo ' <img src="'.get_bloginfo('stylesheet_directory').'/images/disabled_lastroll.png" alt="No Last" style="float: right;" class="disabled_navi" />';
}
$next_comic = get_permalink(get_adjacent_post(true, '', false));
if (!empty($next_comic) && (get_permalink() != $last_comic)) {
echo ' <a href="'.$next_comic.'" class="rollnext" title="Next">&nbsp;</a>';
} else {
echo ' <img src="'.get_bloginfo('stylesheet_directory').'/images/disabled_nextroll.png" alt="No Next" style="float: right;" class="disabled_navi" />';
}
echo ' </div>';
echo ' <div class="clear"></div>';
echo '</div>';
$wp_query = $temp_query;
$wp_query->is_single = $temp_single;
$post = $temp_post;
$temp_post = null;
$temp_query = null;
$temp_single = null;
}
?>

View File

@ -1,8 +1,14 @@
<?php <?php
include(get_template_directory() . '/comicpress-config.php'); if (file_exists(get_template_directory().'/wpmu-functions.php')) {
include(get_template_directory() . '/wpmu-functions.php');
} else {
include(get_template_directory() . '/comicpress-config.php');
}
include(get_template_directory() . '/comment-functions.php'); include(get_template_directory() . '/comment-functions.php');
include(get_template_directory() . '/custom-image-header.php'); include(get_template_directory() . '/custom-image-header.php');
include(get_template_directory() . '/comic-navigation-functions.php');
include(get_template_directory() . '/buystrip-functions.php');
// If any errors occur while searching for a comic file, the error messages will be pushed into here. // If any errors occur while searching for a comic file, the error messages will be pushed into here.
$comic_pathfinding_errors = array(); $comic_pathfinding_errors = array();
@ -139,32 +145,34 @@ function get_terminal_post_in_category($categoryID, $first = true) {
* @param string $filter The $comic_filename_filters to use. * @param string $filter The $comic_filename_filters to use.
* @return string The relative path to the comic file, or false if not found. * @return string The relative path to the comic file, or false if not found.
*/ */
function get_comic_path($folder = 'comic', $override_post = null, $filter = 'default') { if (!function_exists('get_comic_path')) {
global $post, $comic_filename_filters, $comic_folder, $archive_comic_folder, $rss_comic_folder, $comic_pathfinding_errors; function get_comic_path($folder = 'comic', $override_post = null, $filter = 'default') {
global $post, $comic_filename_filters, $comic_folder, $archive_comic_folder, $rss_comic_folder, $comic_pathfinding_errors;
if (isset($comic_filename_filters[$filter])) { if (isset($comic_filename_filters[$filter])) {
$filter_to_use = $comic_filename_filters[$filter]; $filter_to_use = $comic_filename_filters[$filter];
} else { } else {
$filter_to_use = '{date}*.*'; $filter_to_use = '{date}*.*';
} }
switch ($folder) { switch ($folder) {
case "rss": $folder_to_use = $rss_comic_folder; break; case "rss": $folder_to_use = $rss_comic_folder; break;
case "archive": $folder_to_use = $archive_comic_folder; break; case "archive": $folder_to_use = $archive_comic_folder; break;
case "comic": default: $folder_to_use = $comic_folder; break; case "comic": default: $folder_to_use = $comic_folder; break;
} }
$post_to_use = (is_object($override_post)) ? $override_post : $post; $post_to_use = (is_object($override_post)) ? $override_post : $post;
$post_date = mysql2date(CP_DATE_FORMAT, $post_to_use->post_date); $post_date = mysql2date(CP_DATE_FORMAT, $post_to_use->post_date);
$filter_with_date = str_replace('{date}', $post_date, $filter_to_use); $filter_with_date = str_replace('{date}', $post_date, $filter_to_use);
if (count($results = glob("${folder_to_use}/${filter_with_date}")) > 0) { if (count($results = glob("${folder_to_use}/${filter_with_date}")) > 0) {
return reset($results); return reset($results);
} }
$comic_pathfinding_errors[] = sprintf(__("Unable to find the file in the <strong>%s</strong> folder that matched the pattern <strong>%s</strong>. Check your WordPress and ComicPress settings.", 'comicpress'), $folder, $filter_with_date); $comic_pathfinding_errors[] = sprintf(__("Unable to find the file in the <strong>%s</strong> folder that matched the pattern <strong>%s</strong>. Check your WordPress and ComicPress settings.", 'comicpress'), $folder, $filter_with_date);
return false; return false;
}
} }
/** /**
@ -637,42 +645,4 @@ function szub_is_search_key($key='') {
return false; return false;
} }
function comic_navigation() {
global $post;
echo '<div id="comic_navi_wrapper">';
echo ' <div id="comic_navi_prev">';
$at_first = false;
$first = get_first_comic();
if (!empty($first)) { $at_first = ($post->ID == $first->ID); }
if (!$at_first) {
echo ' <a href="'.get_permalink($at_first).'" class="rollfirst">&nbsp;</a>';
} else {
echo ' <img src="'.get_bloginfo('stylesheet_directory').'/images/disabled_firstroll.png" alt="At First" class="disabled_navi" />';
}
$prev_comic = get_permalink(get_previous_comic()->ID);
if (!empty($prev_comic)) {
echo ' <a href="'.$prev_comic.'" class="rollprev">&nbsp;</a>';
} else {
echo ' <img src="'.get_bloginfo('stylesheet_directory').'/images/disabled_prevroll.png" alt="No Previous" class="disabled_navi" />';
}
echo ' </div>';
echo ' <div id="comic_navi_next">';
$next = get_permalink(get_next_comic()->ID);
if (!empty($next)) {
echo ' <a href="'.get_permalink($next).'" class="rollnext">&nbsp;</a>';
} else {
echo ' <img src="'.get_bloginfo('stylesheet_directory').'/images/disabled_nextroll.png" alt="No Next" class="disabled_navi" />';
}
$at_last = false;
$last = get_last_comic();
if (!empty($last)) { $at_last = ($post->idate == $last->idate); }
if (!$at_last) {
echo ' <a href="'.get_permalink($at_last).'" class="rollnext">&nbsp;</a>';
} else {
echo ' <img src="'.get_bloginfo('stylesheet_directory').'/images/disabled_lastroll.png" alt="No Last" class="disabled_navi" />';
}
echo ' </div>';
echo ' <div class="clear"></div>';
echo '</div>';
}
?> ?>

View File

@ -9,7 +9,8 @@
<img src="<?php the_comic() ?>" alt="<?php the_title() ?>" title="<?php the_hovertext() ?>" /> <img src="<?php the_comic() ?>" alt="<?php the_title() ?>" title="<?php the_hovertext() ?>" />
</div> </div>
<div id="comic-foot"></div> <div id="comic-foot"></div>
<?php comic_navigation(); ?> <?php // if (function_exists('buy_this_comic')) { buy_this_comic(); } ?>
<?php // if (function_exists('comic_navigation')) { comic_navigation(); } ?>
<?php endwhile; ?> <?php endwhile; ?>
<div id="content" class="narrowcolumn"> <div id="content" class="narrowcolumn">

View File

@ -1,6 +1,6 @@
<?php get_header() ?> <?php get_header() ?>
<div id="content" class="archive"> <div id="content" class="narrowcolumn">
<div class="post-page-head"></div> <div class="post-page-head"></div>
<div class="post-page"> <div class="post-page">
@ -77,6 +77,6 @@
</div> </div>
<?php include(TEMPLATEPATH . '/sidebar.php') ?> <?php get_sidebar(); ?>
<?php get_footer() ?> <?php get_footer() ?>

View File

@ -1,6 +1,6 @@
<?php get_header() ?> <?php get_header() ?>
<div id="content" class="archive"> <div id="content" class="narrowcolumn">
<div class="post-page-head"></div> <div class="post-page-head"></div>
<div class="post-page"> <div class="post-page">
@ -77,6 +77,6 @@
</div> </div>
<?php include(TEMPLATEPATH . '/sidebar.php') ?> <?php get_sidebar(); ?>
<?php get_footer() ?> <?php get_footer() ?>

View File

@ -6,7 +6,8 @@
<img src="<?php the_comic() ?>" alt="<?php the_title() ?>" title="<?php the_hovertext() ?>" /> <img src="<?php the_comic() ?>" alt="<?php the_title() ?>" title="<?php the_hovertext() ?>" />
</div> </div>
<div id="comic-foot"></div> <div id="comic-foot"></div>
<?php comic_navigation(); ?> <?php // if (function_exists('buy_this_comic')) { buy_this_comic(); } ?>
<?php // if (function_exists('comic_navigation')) { comic_navigation(); } ?>
<?php } endwhile; ?> <?php } endwhile; ?>
<div id="content" class="narrowcolumn"> <div id="content" class="narrowcolumn">

View File

@ -4,7 +4,7 @@ Theme URI: http://comicpress.org
Description: Publish a comic with WordPress. Standard Edition. <a href="http://comicpress.org">Visit the ComicPress Website.</a> Description: Publish a comic with WordPress. Standard Edition. <a href="http://comicpress.org">Visit the ComicPress Website.</a>
Author: Tyler Martin, John Bintz, Philip M. Hofer (Frumph) Author: Tyler Martin, John Bintz, Philip M. Hofer (Frumph)
Author URI: http://mindfaucet.com/ Author URI: http://mindfaucet.com/
Version: 2.7.2 Version: 2.8
. .
The CSS, XHTML and design is released under GPL v3: The CSS, XHTML and design is released under GPL v3:
http://www.opensource.org/licenses/gpl-3.0.html http://www.opensource.org/licenses/gpl-3.0.html
@ -1050,3 +1050,18 @@ a.rollfirst:hover, a.rollprev:hover, a.rollnext:hover, a.rolllast:hover
width: 260px; width: 260px;
float: right; float: right;
} }
/** BUY THIS **/
.buythis {
float: right;
margin-right: 100px;
}
.buythisbutton
{
height: 28px;
width: 240px;
background: url('images/buythis.png') no-repeat;
}