WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Removing Leave a Comment (8 posts)

  1. Vajrasar Goswami
    Member
    Posted 1 year ago #

    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.

  2. 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.

  3. Vajrasar Goswami
    Member
    Posted 1 year ago #

  4. 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.

    http://www.studiopress.com/support/

    Why not head over there and ask them?

  5. Vajrasar Goswami
    Member
    Posted 1 year ago #

    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!

  6. Vajrasar Goswami
    Member
    Posted 1 year ago #

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

  7. 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.

  8. Vajrasar Goswami
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic