• I want to remove “Leave a comment” and replace it with “0 Comments”. How can I achieve that?

    Am doing this so I can display the number of comments in a bubble followed by the text -> Comments. Ex- if 3 Comments. Then 3 will be in bubble and Comments will be outside the bubble.

    I need something that I can do in my function.php as am using a Child Theme.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I need something that I can do in my function.php as am using a Child Theme.

    Maybe but what’s the theme you’ve made a child theme of? That’ll help identify what changes have to be made and where.

    Also a link to the site never hurts and can be used to verify your child theme setup.

    Thread Starter Vajrasar Goswami

    (@vajrasar)

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Nice photos on that site, especially the night ones.

    You’re using a child theme of the Genesis framework. That’s a commercial theme and we don’t support those here.

    Don’t feel bad though, I have reason to believe that that vendor’s support forum is top notch and I am sure you’ll be able to get good support there.

    https://www.studiopress.com/support/

    Why not head over there and ask them?

    Thread Starter Vajrasar Goswami

    (@vajrasar)

    Well, Jan I asked there too, but no response yet. So thought of asking here also. I have been to CODEX and found this –

    <?php comments_popup_link( $zero, $one, $more, $css_class, $none ); ?>

    But I don’t know how to achieve that using function.php!

    Thread Starter Vajrasar Goswami

    (@vajrasar)

    Thanks, we have just started that vertical and are collecting photos from photo enthusiasts from the City. ??

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Generically speaking, you are on the right track…

    Specifically to your case, we don’t have access to that theme (don’t want access either) so we can’t really say one way or the other. That framework is very extensible (I’m told) and it’s probably something easy to adjust.

    Give that other support forum a chance, I’m sure you’ll get support there.

    Thread Starter Vajrasar Goswami

    (@vajrasar)

    Thanks for the help. I did bits from here and there and got this –

    /** Customize the post info function */
    add_filter( 'genesis_post_info', 'post_info_filter' );
    function post_info_filter($post_info) {
    if (!is_page()) {
        $post_info = '[post_date] [post_comments zero="0 Comments" one="1 Comment" more="% Comments"]';
        return $post_info;
    }}
    
    add_filter( 'genesis_post_comments_shortcode', 'child_post_comments_shortcode' );
    
    function child_post_comments_shortcode( $output ){
    
        return preg_replace('/#comments"\>(\d+) Comment/', '#comments"><span class="number">${1}</span> Comment', $output);
    
    }

    Here, child_post_comments_shortcode will be adding a separate span for number and text in -> 0 Comments or 1 Comments and so on for better styling. I git this via Gary’s Code tutorial.

    Maybe it will help someone else. Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Removing Leave a Comment’ is closed to new replies.