ComicPress 2.9.6 and WordPress 3.5 RSS fix for feedburner
This will require some editing of your wp-content/themes/comicpress/functions/syndication.php file
Open up that file on your hosting and replace it with the code available here:
https://github.com/Frumph/comicpress/blob/master/functions/syndication.php
^ the github repo is where I store the latest of every edit I make, bug fixes and what not
If you are logged into github you can find a “zip” button to download the latest full master copy at http://github.com/Frumph/comicpress
Once you are done replacing that bit of code, you edit a post, save it which then updates your feed (clears your feed cache) then go to feedburner and click the resync button in your admin panel for feedburner
– Phil
NOTE: For older ComicPress versions, just replace this portion of the syndication.php file:
if (!function_exists('comicpress_insert_comic_feed')) { function comicpress_insert_comic_feed($content) { global $wp_query, $post; $category = get_the_category($post->ID); if (comicpress_in_comic_category($category[0]->cat_ID)) { $content = comicpress_comic_feed().$content; } return apply_filters('comicpress_insert_comic_feed', $content); } } add_filter('the_content_feed','comicpress_insert_comic_feed'); add_filter('the_excerpt_rss','comicpress_insert_comic_feed');
For ComicPress 2.8 open the syndication.php file and replace this:
//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 }
With this:
//Insert the comic image into the RSS feed function comicpress_comic_feed() { global $post, $comicpress_options; ?> return '<p><a href="'.get_permalink().'">'.comicpress_display_comic_image('rss,comic',$comicpress_options['enable_post_thumbnail_rss']).'</a></p>'; }
Again what you’re doing is ‘returning’ info instead of echo’ing it out.
P.S. change the add_action for the_content to the_content_feed and the_excerpt_rss like the top example, just not the function name after it
For WAYYYY OLD Comicpress’
echo "<p><a href=\""; the_permalink(); echo "\"><img src=\"$siteurl/$filename\" border=\"0\" alt=\"Cartoon thumbnail - "; the_title(); echo " - CLICK for full cartoon\" /></a></p>";
replace that section with this line (all on one line):
return '<p><a href="'.get_permalink().'"><img src="'.$siteurl.'/'.$filename.'" border="0" alt="Cartoon Thumbnail - '.get_the_title().' - Click for FULL Cartoon." /></a></p>';
The idea is to remove the ECHO’s and make it all RETURN
For ComicPress 2.5:
in the functions.php search for this:
function comic_feed() { echo "<p><a href=\""; the_permalink(); echo "\"><img src=\""; echo get_comic_url('rss'); echo "\" border=\"0\" alt=\""; echo the_title(); echo "\" /></a></p>"; }
replace it with this:
function comic_feed() { return '<p><a href="'.get_permalink().'" title="'.get_the_title().'"><img src="'.get_comic_url('rss').'" border="0" alt="'.get_the_title().'" title="'.get_the_title().'"></a></p>'; }
Discussion (30) ¬
That fixed things for me. Thanks so much!
This actually borked my site. I got this error:
Fatal error: Call to undefined function comicpress_themeinfo() in /home/content/y/e/l/yellowperil/html/wp-content/themes/comicpress/functions/syndication.php on line 19
So I restored it to the old version. ugh.
I got the same borking. Upgrading to 3.5 broke my RSS feed. When I apply the changes you listed above I get the “wordpress white screen of death.” When I reupload the old syndication file it works again but the RSS is still broken. Noticed that the new code on github seems to be truncated and doesnt have a close bracket for the PHP.
post edited with what you need to do with your syndication.php file, not replace the whole file but just that small portion
I made the changes you suggested but now the feed doesnt validate and feedburner refuses to resync. Here’s the error:
There is an issue that must be addressed with your source feed for the feed “HijiNKS ENSUE”
The URL you entered does not appear to be a valid feed. We encountered the following problem: Error on line 3: The processing instruction target matching “[xX][mM][lL]” is not allowed.
Never mind. I fixed the feed validity with the “Fix RSS Feed” plugin. I tried to update to the most recent comicpress, but the comic area of my site disappeared and I had to roll back. I suspect there are customizations that are in my actual comicpress theme instead of my child theme.
I tried to update from 2.9.4 to 2.9.6 and it made my comic completely disappear. Any ideas? I had to go back to 2,9.4 for now. If I stay at 2.9.4 are there any security issues or was it just bug fixes?
there were some security fixes yes, it was most likely your comicpress-config.php file that was b0rked, when updating go into yoru ftp and save a copy of that file from your theme directory then re-add it after updating
Now I’m getting this:
Fatal error: Call to undefined function comicpress_in_comic_category()
I’m running Comicpress 2.8. Is that the problem?
yes, comicpress 2.8 doesnsn’t use that function and you need to use the function that 2.8 uses
I use CP 2.7. Will this fix work if I paste the “older code” into my functions.php file? (There is no syndication.php file, or functions folder in this version of CP)
Hi there, I’m in a similar situation – I’m on 2.8 with no image in the feed wince WP 3.5 and am pretty sure the function names are different. I checked Jesus and Mo’s feed and saw it’s working now. How did you fix it?
I need to find my copies of 2.8 ;/ so I can fix those for you.. it’s really simple bug fix (for me), basically we need to get rid of the echo’s and have it return, and use the_content_feed instead of the_content in the filter
Ok, thanks! Let me know if you do. In the meantime I’ll see if I can figure out how to accurately edit the syndication.php to do what you just said.
Hi Frumph… same issue here with an older version of Comicpress. I’ve changed the filter to use the_content_feed instead but I’m not sure I understand what you mean about getting rid of the echo’s. The comic_feed() function I have does some processing and outputs (with echo) a cartoon thumbnail with alt tags etc.
The insert_comic_feed function I have is as is below – is it the first return below that needs to be changed or is it all the echos in the comic_feed() function:
function insert_comic_feed($content) {
global $comiccat;
if (is_feed() && in_category($comiccat)) {
return comic_feed($echo=false).$content;
} else {
return $content;
}
}
Thanks!
You’re missing a function, function comic_feed() {} .. would need to see what that one does
Hi.. thanks so much for the quick response! Below is the comic_feed function:
function comic_feed() {
global $post, $rss_comic_folder;
$todays_comic = mysql2date('Y-m-d H', $post->post_date);
$todays_comic = preg_replace('/\s/', '_', $todays_comic);
$siteurl = get_settings('siteurl');
$filename = "$rss_comic_folder/$todays_comic*.*";
$file = glob("$filename");
$filename = $file[0];
echo "";
}
(You actually helped me customise this many years back allowing me to post more than 1 comic a day 🙂 Thanks again!
Hmmm… the echo didn’t come out right in that function snippet because of the backslashes in the echo statement I think… I’ve replaced each backslash with [b] below. So the line echo “”; above should be:
echo "";
Sorry about that .. the echo statement lines don’t seem to display properly in the comment – I’ve put the relevant functions in a text file here:
http://www.wonkie.com/comic_feed-function.txt
Thanks
updated it for way older comicpress versions to show that removing the echo’s and having it return fixes it
Heya, I’m not sure how to make that work for Comicpress 2.8. This is the syndication.php for it: https://github.com/johnbintz/comicpress-2.8/blob/master/functions/syndication.php
That bit of code you said to replace above doesn’t exist in exactly that way. Any ideas? Thanks!
Wonkie, are you on 2.8?
Hi Mary.. No this was a much older version of CP… 2.5 I think (before storylines etc were introduced)… there was no syndication.php file in that version.
ps: loved NPC Comic 🙂
added the code for 2.8 to fix it into the post
Thanks so much Phil!! The new code worked perfectly 🙂
Added code for 2.8 replacement into the post
Thanks! I wasn’t able to get it to work. Gives me a server error, and I’m guessing there’s some syntax error, as it seems to break the code underneath. I’ll keep tooling around with it. If you have any ideas, I’d love to hear them. Thanks!
Yeah, I’m using CP-GN (CP 2.5), waaaaay old, no functions folder within the comicpress-gn folder and no syndication.php. I doing a search of the php files for thumbnail instances but am coming up empty. Any ideas how to patch this old mule up to get the thumbnails back (yeah, I know, I know, I should upgrade to a modern theme).
that would be inside the functions.php file for 2.5
Thanks. Thanks so much.