Forums

[resolved] Add comment count to functions.php (13 posts)

  1. callender
    Member
    Posted 1 year ago #

    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)

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    where in that line do you want the comment count to show?

    btw:
    that is the code for the bottom of the post.

  3. callender
    Member
    Posted 1 year ago #

    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

  4. alchymyth
    The Sweeper
    Posted 1 year ago #

    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

  5. callender
    Member
    Posted 1 year ago #

    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.

  6. alchymyth
    The Sweeper
    Posted 1 year ago #

    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?

  7. callender
    Member
    Posted 1 year ago #

    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)', 'twentyten' );

  8. alchymyth
    The Sweeper
    Posted 1 year ago #

    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?

  9. callender
    Member
    Posted 1 year ago #

    Hiya, yes I am looking for the comment number on posted on.

    Really appreciate this alchymyth!

    Jim

  10. alchymyth
    The Sweeper
    Posted 1 year ago #

    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

  11. callender
    Member
    Posted 1 year ago #

    you're a legend! thanks so much!

  12. alchymyth
    The Sweeper
    Posted 1 year ago #

    if everything works as expected, please tick this thread off as 'resolved' - thanks

  13. katie@tskentucky.com
    Member
    Posted 11 months ago #

    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 but the website I'd like to see mine resemble, 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!

Topic Closed

This topic has been closed to new replies.

About this Topic