Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution)

Question

Thanks, Tami,

That doesn’t work even though it seems like it should. I had a similar problem with functions when trying to get rid of the read more link using functions. I suggest the culprit may be related to the following . . .

  1. The “blog” in question is actually generated from a link in the main menu that generates posting in a given category. There will be many of these eventually.
  2. I’m using a function that makes each post a full post rather than an excerpt. Even that function is only partially working.

Could one of these be causing trouble?

/**
 * Redefine sinatra_excerpt function.
 * 
 */
function sinatra_excerpt( $more = null, $length = null ) {
    the_content();
}

/*
 * @param string $output A translatable string formatted based on whether the count
 *                       is equal to 0, 1, or 1+.
 * @param int    $number The number of post comments.
 * @return string $output
 */
function richards_no_comment_string( $output, $number ){

    if( $number === 0 ){
        
        $output = __( 'Leave a Comment' );
    }

    return $output;
}
add_filter('comments_number', 'richards_no_comment_string', 20, 2);

Here’s a link to the page in question:

https://poets.drifting-sands-haibun.org/category/all-poet-blogs/richard-grahn/

Thanks again, Richard

0
Richard Grahn 2 months 2021-10-10T10:40:23-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse