• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Customizing Comment Number

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Customizing Comment Number

This topic is: not resolved

Tagged: comment number

  • This topic has 3 replies, 4 voices, and was last updated 11 years, 9 months ago by Gary Jones.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • September 7, 2013 at 3:10 pm #61255
    ameeker
    Member

    Using Gary Jones' snippet to separate the comment number from the comment text (http://code.garyjones.co.uk/style-comment-number) but not getting that result. Does it look like the snippet below still works? I tried also replacing the #comments with .entry-comments since I'm using Metro Pro both in the snippet and the style sheet

    add_filter( 'genesis_post_comments_shortcode', 'child_post_comments_shortcode' );
    /**
     * Amend the post comments shortcode to add extra markup for styling.
     *
     * @author Gary Jones
     * @link   http://code.garyjones.co.uk/style-comment-number/
     *
     * @param string $output HTML markup, likely with shortcodes.
     *
     * @return string HTML markup.
     */
    function child_post_comments_shortcode( $output ){
     
        return preg_replace('/#comments"\>(\d+) Comment/', '#comments"><span class="number">
    </span> Comment', $output);
     
    }
    .post-comments {
    	color: #333;
    	font-size: 12px;
    }
    .post-comments .number {
    	font-size: 15px;
    }

    Looking for Genesis website design backed by strategy? http://www.angiemeekerdesigns.com

    September 8, 2013 at 4:53 pm #61407
    cdils
    Participant

    Hey Angie,
    Does the function change the output at all (if you're looking in your source are you seeing <span class="number">)?

    The filter is still valid (see http://my.studiopress.com/docs/filter-reference/), but it looks like it accepts 2 arguments - $output, $args. Not sure if the absence of $args matters, but what do I know? 🙂

    I'll see if Gary can stop by and comment...

    Carrie


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂

    I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.

    September 8, 2013 at 5:09 pm #61411
    nunotmp
    Member

    What exactly are you trying to do?


    Genesis Child Themes – Follow Me

    September 9, 2013 at 5:08 am #61477
    Gary Jones
    Member

    If you've used the [post_comments] attributes of more or one to change the default to something other than "<digit><space>Comment", then it the regex won't see it.

    If you want it to work for zero as well, then use [post_comments zero="0 Comments"] so it is consistent. You may need to filter this in to your genesis_post_info output (by code, or by Genesis Simple Edits.


    WordPress Engineer, and key contributor the Genesis Framework | @GaryJ

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble