How to show Disqus comment count number only without text?

Not sure how it’ll behave with Disqus, but try the following filter:

add_filter( 'comments_number', 'comments_text_wpse_87886', 10, 2 );

function comments_text_wpse_87886 ( $output, $number )
{
    return $number;
}

The original return is $output, and instead we are returning only the number of comments. That filter happens in the following core function, reproduced here if you want to adapt the previous filter hook:

function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
    if ( !empty( $deprecated ) )
        _deprecated_argument( __FUNCTION__, '1.3' );

    $number = get_comments_number();

    if ( $number > 1 )
        $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
    elseif ( $number == 0 )
        $output = ( false === $zero ) ? __('No Comments') : $zero;
    else // must be one
        $output = ( false === $one ) ? __('1 Comment') : $one;

    echo apply_filters('comments_number', $output, $number);
}

Related: Where to put my code: plugin or functions.php?

Leave a Comment