• 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

Show number of comments in link title?

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 › Design Tips and Tricks › Show number of comments in link title?

This topic is: resolved

Tagged: comments, templates, Wordpress

  • This topic has 4 replies, 3 voices, and was last updated 10 years, 11 months ago by Birming.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • March 16, 2015 at 4:06 am #144593
    Birming
    Member

    I'm trying to show the number of comments (the "X comments..." part) in this custom code:

    //* Permalink excerpts for the 'Citat' category and tags archive
    add_filter( 'genesis_entry_content' , 'quotes_excerpt_prefix', 1 );
    function quotes_excerpt_prefix() {
    	if ( is_category( 8 ) || is_tag() )
    		printf( '<h2><a href="%s" title="X comments for this post">', get_permalink(), the_title_attribute( 'echo=0' ) );
    }
    add_filter( 'genesis_entry_content' , 'quotes_excerpt_suffix', 11 );
    function quotes_excerpt_suffix() {
    	if ( is_category( 8 ) || is_tag() )
    		printf( '</a></h2>' );
    }

    Anyone who can help me accomplish that? Thanks in advance!


    Robert Birming
    Mittpunkt

    March 16, 2015 at 10:45 am #144633
    seoskyrocket
    Member

    I'm no master at code, but I do believe that the Genesis Simple Edits plugin will perform this task if you add the [post_comments] shortcode to the "Entry Meta" section(s) where you want the number of comments to appear. I hope that helps.

    March 16, 2015 at 11:36 am #144647
    Birming
    Member

    Thanks for your reply! I tried something like that before, but couldn't get it to work.


    Robert Birming
    Mittpunkt

    March 17, 2015 at 5:42 am #144711
    WisdmLabs
    Member

    Hey Birming,
    get_comments_number( $post_id ); will give the no. of comments the post has. You can read more about it on http://codex.wordpress.org/Template_Tags/get_comments_number.


    http://wisdmlabs.com/

    March 17, 2015 at 7:20 am #144726
    Birming
    Member

    Thank you!


    Robert Birming
    Mittpunkt

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ 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

© 2026 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