now passing $title_to_use to the comicpress_display_comic_image code so that the title represents what it needs to when using the override post.

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2010-01-02 12:42:28 -08:00
parent 3ef3b76d25
commit a59711c6cb
3 changed files with 14 additions and 16 deletions

View File

@ -31,12 +31,6 @@ if (have_posts()) {
$description = $category->description;
$first_comic_in_category = get_terminal_post_in_category($category_id,true);
$first_comic_permalink = get_permalink($first_comic_in_category->ID);
$archive_image = null;
foreach (array("mini", "archive", "rss", "comic") as $type) {
if (($requested_archive_image = get_comic_url($type, $first_comic_in_category)) !== false) {
$archive_image = $requested_archive_image; break;
}
}
if ($target_depth < $current_depth) {
echo str_repeat("</ul></li>", ($current_depth - $target_depth));
}
@ -49,7 +43,7 @@ if (have_posts()) {
<li id="storyline-<?php echo $category->category_nicename ?>"<?php echo $storyline_root; $storyline_root = null ?>>
<?php if (!empty($first_comic_in_category)) { ?>
<a href="<?php echo $first_comic_permalink ?>" title="<?php _e('First comic in','comicpress'); ?> <?php echo $category->cat_name ?>."><img src="<?php echo $archive_image ?>" style="width: <?php echo $mini_comic_width; ?>px" /></a>
<a href="<?php echo $first_comic_permalink ?>" title="<?php _e('First comic in','comicpress'); ?> <?php echo $category->cat_name ?>."><?php echo comicpress_display_comic_image('mini,archive,rss,comic', false, $first_comic_in_category, __('First comic in','comicpress').' '.$category->cat_name); ?></a>
<?php } ?>
<a href="<?php echo get_category_link($category_id) ?>" class="storyline-title"><?php echo $category->cat_name ?></a>
<?php if (!empty($description)) { ?>

View File

@ -720,9 +720,11 @@ function comicpress_list_storyline_categories($args = "") {
* Display text when image (comic) is hovered
* Text is taken from a custom field named "hovertext"
*/
function the_hovertext() {
$hovertext = get_post_meta( get_the_ID(), "hovertext", true );
return (empty($hovertext)) ? get_the_title() : $hovertext;
function the_hovertext($post_to_use = null) {
global $post;
$post_to_use = !is_null($override_post) ? $override_post : $post;
$hovertext = get_post_meta( $post_to_use->ID, "hovertext", true );
return (empty($hovertext)) ? get_the_title($post_to_use->ID) : $hovertext;
}
/**

View File

@ -1,12 +1,14 @@
<?php
function comicpress_display_comic_image($searchorder = "comic",$use_post_image = false) {
function comicpress_display_comic_image($searchorder = "comic",$use_post_image = false, $override_post = null, $title = null) {
global $post;
$post_to_use = !is_null($override_post) ? $override_post : $post;
$title_to_use = !is_null($title) ? $title : the_hovertext($post_to_use);
if ($use_post_image) {
if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail($post->ID) ) {
$comic_image = get_the_post_thumbnail($post->ID,'full');
$comic_image = preg_replace('#title="([^*]*)"#', 'title="'.the_hovertext().'"', $comic_image);
if ( has_post_thumbnail($post_to_use->ID) ) {
$comic_image = get_the_post_thumbnail($post_to_use->ID,'full');
$comic_image = preg_replace('#title="([^*]*)"#', 'title="'.$title_to_use.'"', $comic_image);
}
}
}
@ -14,8 +16,8 @@ function comicpress_display_comic_image($searchorder = "comic",$use_post_image =
$searchorder = explode(',',$searchorder);
$requested_archive_image = '';
foreach ($searchorder as $type) {
if (($requested_archive_image = get_comic_url($type, $post)) !== false) {
$comic_image = "<img src=\"$requested_archive_image\" alt=\"".get_the_title()."\" title=\"".the_hovertext()."\" />";
if (($requested_archive_image = get_comic_url($type, $post_to_use)) !== false) {
$comic_image = "<img src=\"$requested_archive_image\" alt=\"".get_the_title($post_to_use)."\" title=\"".$title_to_use."\" />";
break;
}
}