fix rss_counts_comment, fixed GH#6
This commit is contained in:
parent
86547ca4b7
commit
923bda444d
|
@ -820,21 +820,6 @@ function comicpress_check_child_file($filename = '') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
function rss_count_comments(){
|
|
||||||
global $wpdb,$post;
|
|
||||||
$args = func_get_args();
|
|
||||||
$comments = get_comments_number();
|
|
||||||
echo $args[0];
|
|
||||||
if ($comments == 0) $comment_text = " (No Comments)";
|
|
||||||
if ($comments == 1) $comment_text = " (1 Comment)";
|
|
||||||
if ($comments > 1) $comment_text = " (". $comments . " Comments)";
|
|
||||||
if ($comments>0) echo $comment_text;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action('the_title_rss','rss_count_comments');
|
|
||||||
*/
|
|
||||||
|
|
||||||
function comicpress_gnav_display_css() {
|
function comicpress_gnav_display_css() {
|
||||||
global $comicpress_options;
|
global $comicpress_options;
|
||||||
if (file_exists(get_stylesheet_directory() . '/images/nav/' . $comicpress_options['graphicnav_directory'] . '/navstyle.css')) { ?>
|
if (file_exists(get_stylesheet_directory() . '/images/nav/' . $comicpress_options['graphicnav_directory'] . '/navstyle.css')) { ?>
|
||||||
|
|
|
@ -48,12 +48,43 @@ function cp_add_to_feed_count_rss2() {
|
||||||
$feedcount = get_option('comicpress_feed_count_rss2');
|
$feedcount = get_option('comicpress_feed_count_rss2');
|
||||||
if (!empty($feedcount)) {
|
if (!empty($feedcount)) {
|
||||||
$feedcount = $feedcount + 1;
|
$feedcount = $feedcount + 1;
|
||||||
update_option('comicpress_feed_count_rss2', $feedcount);
|
update_option('comicpress_feed_count_rss2', $feedcount);
|
||||||
} else {
|
} else {
|
||||||
add_option('comicpress_feed_count_rss2', 1, ' ', 'yes');
|
add_option('comicpress_feed_count_rss2', 1, ' ', 'yes');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('do_feed_rss2', 'cp_add_to_feed_count_rss2',5);
|
add_action('do_feed_rss2', 'cp_add_to_feed_count_rss2',5);
|
||||||
*/
|
*/
|
||||||
?>
|
|
||||||
|
/**
|
||||||
|
* Add the number of post comments to the title of the RSS feed items.
|
||||||
|
* TODO Make this togglable via options.
|
||||||
|
* @param string $title The title of the post.
|
||||||
|
* @return string The filtered title of the post.
|
||||||
|
*/
|
||||||
|
function comicpress_the_title_rss($title = '') {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle making changes to ComicPress before the export process starts.
|
||||||
|
*/
|
||||||
|
function comicpress_export_wp() {
|
||||||
|
remove_filter('the_title_rss', 'comicpress_the_title_rss');
|
||||||
|
}
|
||||||
|
|
||||||
|
add_filter('the_title_rss', 'comicpress_the_title_rss');
|
||||||
|
add_action('export_wp', 'comicpress_export_wp');
|
||||||
|
|
Loading…
Reference in New Issue