Title: Add comment count to functions.php
Last modified: August 19, 2016

---

# Add comment count to functions.php

 *  Resolved [callender](https://wordpress.org/support/users/jimcallender/)
 * (@jimcallender)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/)
 * Hi there,
 * I want the number of comments and link (#comments) to appear at the top of my
   post.
 * I am using the 2010 theme which has the following;
 *     ```
       function twentyten_posted_in() {
       	// Retrieves tag list of current post, separated by commas.
       	$tag_list = get_the_tag_list( '', '/ ' );
       	if ( $tag_list ) {
       		$posted_in = __( 'Category: %1$s <hr />Tags: %2$s<hr />', 'twentyten' );
       	} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
       		$posted_in = __( 'Category: %1$s <hr />', 'twentyten' );
       	} else {
       		$posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
       	}
       ```
   
 * Where do I add the comment, and what code?
    (The codex examples only show hooks
   for the Loop)

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991396)
 * where in that line do you want the comment count to show?
 * btw:
    that is the code for the bottom of the post.
 *  Thread Starter [callender](https://wordpress.org/support/users/jimcallender/)
 * (@jimcallender)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991407)
 * Hi the sweeper,
 *     ```
       if ( $tag_list ) {
       		$posted_in = __( 'Category: %1$s <hr />Tags: %2$s<hr /><strong>**COMMENT COUNT HERE**</strong>', 'twentyten' );
       ```
   
 * Ideally to appear after the tags line, so in order – category, tags and comment
   count.
 * Many thanks for your help!
 * J
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991413)
 * you are aware that this is **below **the post?
 * **above **the post would be ‘posted on … by …’ and this would be done by ‘twentyten_posted_on()’
   in functions.php
 *  Thread Starter [callender](https://wordpress.org/support/users/jimcallender/)
 * (@jimcallender)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991418)
 * yes I am aware of these lines, but the design requires it in a slightly diff.
   layout.
 * this is why i am editing the functions.php and hence the code above.
 * everything is working as it should, ie: date, category, tags – just the comment
   count is missing..
 * Can you help? many thanks.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991427)
 * i don’t really understand what you want:
 * > I want the number of comments and link (#comments) to appear at the top of 
   > my post.
 * do you want that on the **front **page of twenty ten?
 * is so, this would require to edit the code of `twentyten_posted_in()`
 * > Ideally to appear after the tags line, so in order – category, tags and comment
   > count
 * that is **below **the post – and in twenty ten, this is done in loop.php, and
   already has the comments number.
 * can you check back with your design guru and clarify?
 *  Thread Starter [callender](https://wordpress.org/support/users/jimcallender/)
 * (@jimcallender)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991434)
 * > I want the number of comments and link (#comments) to appear at the top of 
   > my post.
 * >> On the single.php post file of 2010 theme.
 * So would it be something like this:
 * $posted_in = __( ‘Category: %1$s 
   <hr />Tags: %2$s<hr />Comments: [ (% Comments)](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/?output_format=md#disqus_thread)‘,‘
   twentyten’ );
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991439)
 * do you want to move the line with ‘posted in’ etc to the top of the post?
 * or do you want the comment number in the line with ‘posted on’ etc which is already
   on top of the post?
 *  Thread Starter [callender](https://wordpress.org/support/users/jimcallender/)
 * (@jimcallender)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991461)
 * Hiya, yes I am looking for the comment number on posted on.
 * Really appreciate this alchymyth!
 * Jim
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991477)
 * [http://pastebin.com/5m2b1Lsz](http://pastebin.com/5m2b1Lsz)
 * check it out and come back if you have questions 😉
 * btw:
    are you aware that twenty ten modifications will be overwritten with your
   next upgrade of your wordpress version? consider [http://codex.wordpress.org/Child_Themes](http://codex.wordpress.org/Child_Themes)
 *  Thread Starter [callender](https://wordpress.org/support/users/jimcallender/)
 * (@jimcallender)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991480)
 * you’re a legend! thanks so much!
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991482)
 * if everything works as expected, please tick this thread off as ‘resolved’ – 
   thanks
 *  [katie@tskentucky.com](https://wordpress.org/support/users/katietskentuckycom/)
 * (@katietskentuckycom)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991666)
 * Hello all! I am attempting to get the same thing – the comment count with a link
   to the comments on my posts. My website is [http://lynnmotley.com/?page_id=131](http://lynnmotley.com/?page_id=131)
   but the website I’d like to see mine resemble, [http://www.laurarobertsdesign.com/blog/](http://www.laurarobertsdesign.com/blog/),
   in terms of how the comment count and link appear by the post title.
 * Also, I want for users to be able to add a comment to a post no matter how they
   get to it…..via the archives, tags, blog, however. Is this a possibility?
 * I am using the Satoshi theme by Voosh Themes.
 * Thanks for any help you can offer this newbie!

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Add comment count to functions.php’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [single](https://wordpress.org/support/topic-tag/single/)
 * [twenty ten](https://wordpress.org/support/topic-tag/twenty-ten/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 12 replies
 * 3 participants
 * Last reply from: [katie@tskentucky.com](https://wordpress.org/support/users/katietskentuckycom/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/add-comment-count-to-functionsphp/#post-1991666)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
