RSS Feed revamp to use post_thumbnails & the new comicpress_display_comic_image()
can also set that on and off (default: on) in the options Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
parent
1b31062590
commit
3ef3b76d25
|
@ -46,6 +46,7 @@ function comicpress_admin() {
|
|||
'disable_comment_note',
|
||||
'enable_numbered_pagination',
|
||||
'enable_comment_count_in_rss',
|
||||
'enable_post_thumbnail_rss',
|
||||
'comic_clicks_next',
|
||||
'disable_default_comic_nav',
|
||||
'enable_widgetarea_use_sidebar_css',
|
||||
|
|
|
@ -119,6 +119,7 @@ function comicpress_load_options() {
|
|||
'disable_page_titles' => false,
|
||||
'static_blog' => false,
|
||||
'disable_default_comic_nav' => false,
|
||||
'enable_post_thumbnail_rss' => true,
|
||||
|
||||
'cp_theme_layout' => 'standard',
|
||||
'transcript_in_posts' => false,
|
||||
|
@ -721,7 +722,7 @@ function comicpress_list_storyline_categories($args = "") {
|
|||
*/
|
||||
function the_hovertext() {
|
||||
$hovertext = get_post_meta( get_the_ID(), "hovertext", true );
|
||||
echo (empty($hovertext)) ? get_the_title() : $hovertext;
|
||||
return (empty($hovertext)) ? get_the_title() : $hovertext;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -762,26 +763,6 @@ function the_transcript($displaymode = 'raw') {
|
|||
}
|
||||
}
|
||||
|
||||
//Insert the comic image into the RSS feed
|
||||
function comic_feed() {
|
||||
foreach (array("rss", "archive", "mini", "comic") as $type) {
|
||||
if (($requested_thumbnail_image = get_comic_url($type, $first_comic_in_category)) !== false) {
|
||||
$thumbnail_image = $requested_thumbnail_image; break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<p><a href="<?php the_permalink() ?>"><img src="<?php echo $thumbnail_image; ?>" border="0" alt="<?php the_title() ?>" title="<?php the_hovertext() ?>" /></a></p><?php
|
||||
}
|
||||
|
||||
function insert_comic_feed($content) {
|
||||
if (is_feed() && in_comic_category()) {
|
||||
return comic_feed() . $content;
|
||||
} else {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
add_filter('the_content','insert_comic_feed');
|
||||
|
||||
// Register Sidebar and Define Widgets
|
||||
|
||||
if ( function_exists('register_sidebar') ) {
|
||||
|
|
|
@ -6,6 +6,7 @@ function comicpress_display_comic_image($searchorder = "comic",$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +15,7 @@ function comicpress_display_comic_image($searchorder = "comic",$use_post_image =
|
|||
$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=\"".get_the_title()."\" />";
|
||||
$comic_image = "<img src=\"$requested_archive_image\" alt=\"".get_the_title()."\" title=\"".the_hovertext()."\" />";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ function display_comics_multi() {
|
|||
if (($result = get_comic_path('comic', '', '', 1)) !== false) {
|
||||
foreach ($result as $pathto_comic) { ?>
|
||||
<div class="comicdisp">
|
||||
<img src="<?php echo get_option('home'). '/' .$pathto_comic; ?>" alt="<?php the_title(); ?>" title="<?php the_hovertext(); ?>" />
|
||||
<img src="<?php echo get_option('home'). '/' .$pathto_comic; ?>" alt="<?php the_title(); ?>" title="<?php echo the_hovertext(); ?>" />
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
|
|
|
@ -91,3 +91,23 @@ if ($comicpress_options['enable_comment_count_in_rss']) {
|
|||
add_filter('the_title_rss', 'comicpress_the_title_rss');
|
||||
add_action('export_wp', 'comicpress_export_wp');
|
||||
}
|
||||
|
||||
//Insert the comic image into the RSS feed
|
||||
function comicpress_comic_feed() {
|
||||
global $post, $comicpress_options; ?>
|
||||
<p><a href="<?php the_permalink() ?>"><?php echo comicpress_display_comic_image('rss,comic',$comicpress_options['enable_post_thumbnail_rss']); ?></a></p><?php
|
||||
}
|
||||
|
||||
// removed the in_comic_category so that if it has a post-image it will add it to the rss feed (else rss comic thumb)
|
||||
function comicpress_insert_comic_feed($content) {
|
||||
global $post, $wp_query;
|
||||
if (is_feed()) {
|
||||
return comicpress_comic_feed() . $content;
|
||||
} else {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
add_filter('the_content','comicpress_insert_comic_feed');
|
||||
|
||||
?>
|
||||
|
|
|
@ -47,6 +47,14 @@
|
|||
<?php _e('Checkmark this and your site will not display the contents of #blogheader.','comicpress'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"><?php _e('RSS','comicpress'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr class="alternate">
|
||||
<th scope="row"><label for="enable_comment_count_in_rss"><?php _e('Enable the comment count to show in feed title.','comicpress'); ?></label></th>
|
||||
<td>
|
||||
|
@ -56,6 +64,15 @@
|
|||
<?php _e('Will show how many comments there are in the title of the post in the feed.','comicpress'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="enable_post_thumbnail_rss"><?php _e('Enable the post thumbnails in the RSS feed?','comicpress'); ?></label></th>
|
||||
<td>
|
||||
<input id="enable_post_thumbnail_rss" name="enable_post_thumbnail_rss" type="checkbox" value="1" <?php checked(true, $comicpress_options['enable_post_thumbnail_rss']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('If enabled will show the post thumbnail of the post in the RSS feed.','comicpress'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="widefat">
|
||||
|
|
Loading…
Reference in New Issue