Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rewrite of the comment count in the title for the feeds

  • Loading branch information...
commit 2bf94c2113bfc214074a1e4b9ca2c3028623da95 1 parent 4bfae61
@Frumph authored
Showing with 8 additions and 22 deletions.
  1. +8 −22 functions/syndication.php
View
30 functions/syndication.php
@@ -1,39 +1,25 @@
<?php
-/**
- * Syndication - Feed Count Capturing & adding comic to feed.
- * Author: Philip M. Hofer (Frumph)
- * In Testing
- */
-function comicpress_the_title_rss($title = '') {
+function comicpress_add_count_to_title_rss($title = '') {
global $post;
if (!empty($post)) {
- switch ($count = get_comments_number()) {
- case 0:
- $title_pattern = __('%s (No Comments)', 'comicpress');
- break;
- case 1:
- $title_pattern = __('%s (1 Comment)', 'comicpress');
- break;
- default:
- $title_pattern = sprintf(__('%%s (%d Comments)', 'comicpress'), $count);
- break;
- }
- return sprintf($title_pattern, $title);
+ $count = get_comments_number();
+ $count == 0 ? $title = $title.' '.__('(No Comments)','comicpress') : $title = $title.' '.sprintf(_n('(%s Comment)','(%s Comments)', $count, 'comicpress'),$count);
+ return apply_filters('comicpress_add_count_to_title_rss', $title);
}
}
/**
* Handle making changes to ComicPress before the export process starts.
*/
-function comicpress_export_wp() {
- remove_filter('the_title_rss', 'comicpress_the_title_rss');
+function comicpress_remove_count_export_wp() {
+ remove_filter('the_title_rss', 'comicpress_add_count_to_title_rss');
}
if (comicpress_themeinfo('enable_comment_count_in_rss')) {
- add_filter('the_title_rss', 'comicpress_the_title_rss');
+ add_filter('the_title_rss', 'comicpress_add_count_to_title_rss');
// Remove the title count from being in the export.
- add_action('export_wp', 'comicpress_export_wp');
+ add_action('export_wp', 'comicpress_remove_count_export_wp');
}
//Insert the comic image into the RSS feed
Please sign in to comment.
Something went wrong with that request. Please try again.