Support » Themes and Templates » Styling comments on twentyten child theme

  • Hi there,
    I’ve been trying to find this solution, to styling my comments, but am only part way there.

    What I want:
    1)When there are no comments on the post, instead of viewing ‘0 Comments’, I want it to say ‘Care to comment?’.

    2)If there are comments on the post, I want it to say ‘3 Comments – What do you think?’.

    3)The ability to style just the number, when there is a comment.
    Eg. 2 Comments

    I’ve been able to do this with my old template, but I can’t seem to figure it out for twentyten child theme.

    This is what I have so far in my functions.php
    Thanks to someone on this forum.

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 5 replies - 1 through 5 (of 5 total)
  • The code for the comments is in the parent theme (in this case Twenty Ten). Copy the file that it is in (usually comments.php or single.php & page.php) into your child theme and make the edits there.

    Hi Andrew,
    I understand where I have to change it, but don’t understand how.
    Here is what I have in my functions.php so far.



    Forum Moderator

    That code has nothing to do with your comments. Re-read what andrew_cpht suggested.

    @happyworker like I said, you’ll need to copy the comments.php (or single.php/page.php) from twenty ten to your child theme and make the changes there.

    Thanks for your responses, but maybe I’m just not being clear.

    In the comments.php it states the following:

    * The template for displaying Comments.
    * The area of the page that contains both current comments
    * and the comment form. The actual display of comments is
    * handled by a callback to twentyten_comment which is
    * located in the functions.php file.

    * @package WordPress
    * @subpackage Twenty_Ten
    * @since Twenty Ten 1.0

    I want to deal with the actual display, so I included the code [in previous comment] to handle the display of the comment number.

    In the page.php it only has the following:

    <?php comments_template( '', true ); ?>

    which is after the post. This is fine, I don’t want to change this.

    In the single.php it calls the following:

    <div class="entry-meta">
    <?php twentyten_posted_on(); ?>
    </div><!-- .entry-meta -->

    Which is fine, that’s calling the code I have in the functions.php
    The above code is also in my loop.php which means that it will show up on all posts anywhere – this is also fine.

    My child theme includes the following files:

    Now what I’m trying to do is fix the functions.php code to do the following, since the twentyten_posted_on (); is in the loop and will change it everywhere.

    Now I’m figuring that this part of the code I’m going to have to change.

    sprintf( '<span class="meta-comment-count"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
                            '#comments', // use #comments to jump to top of comments; use #respond to jump to comment form
                            'jump to comments', // link alt text
                            (get_comments_number() != 1) ? get_comments_number().' comments' : get_comments_number().' comment'  // comments number

    But I’m just not that good to figure it out.

    I’ve done this before on a different theme and here is what the code looks like.

    <?php $comment_count = get_comment_count($post->ID); ?>
    <?php if ($comment_count['approved'] > 0) : ?> | <?php comments_popup_link('','<span style="font-size:1.5em;font-weight:bold;">1</span> comment','<span style="font-size:1.5em;font-weight:bold;">%</span> comments','',''); ?> , <a style="color:#0099cc;" href="<?php the_permalink(); ?>#commentform">what's your opinion?</a>
    <?php else : ?> | <a style="color:#0099cc" href="<?php the_permalink(); ?>#commentform"> Care to comment?</a><?php endif; ?>

    Thanks again for the responses.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Styling comments on twentyten child theme’ is closed to new replies.