ThemeShaper Forums » Thematic

How to number Threaded Comments

(16 posts)
  • Started 5 years ago by LegendsCrazy
  • Latest reply from McGirl2008
  • This topic is resolved
  1. Could someone tell me what I need to do to have my comments be numbered sequentially? I would like for the number to show to the left of the Avatar/Gravatar. Thanks in advance for any help.

    Posted 5 years ago #
  2. Hey,

    just found Greg's Threaded Comment Numbering. Will do some testing the next days.

    Cheers,

    Chris

    Posted 5 years ago #
  3. Thanks Chris! I appreciate your help.

    Posted 5 years ago #
  4. Hey,

    did a test with the plugin .. it'll give you a hierarchical numbering like "1.1.2.2.1".

    Let me know if this is the thing you're looking for and where it should be placed. Would need to add a filter to Thematic.

    Cheers,

    Chris

    Posted 5 years ago #
  5. Thanks Chris. I looked at the plug-in and that seems to be exactly what I was looking for. I would like for the numbering to show up to the left of the avatars. Number, then avatar, then author, metadata, etc. Here is a link to one of my posts with comments:

    http://legendscrazy.net/poll-results/#comments

    Posted 5 years ago #
  6. This caused some headaches 'cause I started to filter on the wrong end :-)

    Now I got it. Get the latest version from Thematic - Google Code.

    Install the above mentioned plugin.

    Then add the following code to your child theme's functions.php:

    function my_comments($comment, $args, $depth) {
        $GLOBALS['comment'] = $comment;
    	$GLOBALS['comment_depth'] = $depth;
        ?>
        	<li id="comment-<?php comment_ID() ?>" class="<?php thematic_comment_class() ?>">
        		<div class="comment-author vcard"><?php thematic_commenter_link() ?></div>
        		<div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'thematic'),
        					get_comment_date(),
        					get_comment_time(),
        					'#comment-' . get_comment_ID() );
        					edit_comment_link(__('Edit', 'thematic'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?></div>
        <?php if ($comment->comment_approved == '0') _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'thematic') ?>
                <div class="comment-content">
            		<?php comment_text() ?>
        		</div>
    
    				<?php echo gtcn_comment_numbering($comment->comment_ID, $args); ?>
    
    			<?php // echo the comment reply link with help from Justin Tadlock http://justintadlock.com/ and Will Norris http://willnorris.com/
    				if($args['type'] == 'all' || get_comment_type() == 'comment') :
    					comment_reply_link(array_merge($args, array(
    						'reply_text' => __('Reply','thematic'),
    						'login_text' => __('Log in to reply.','thematic'),
    						'depth' => $depth,
    						'before' => '<div class="comment-reply-link">',
    						'after' => '</div>'
    					)));
    				endif;
    			?>
    <?php }
    
    function my_callback() {
    	$content = 'type=comment&callback=my_comments';
    	return $content;
    }
    add_filter('list_comments_arg', 'my_callback');

    The first function is the new callback for wp_list_comments() .. I already added the gtcn_comment_numbering function call. Leave it at this position for a first test. Later on you might want to move it to a different position.

    The second function connects the new callback to wp_list_comments().

    Tested and Approved.

    Cheers,

    Chris

    Posted 5 years ago #
  7. Hi Chris,

    I got a blank screen and this error code after I uploaded:

    Parse error: syntax error, unexpected '}' in ../themes/legendscrazy.net/functions.php on line 30

    and I know absolutely nothing about php.

    Edit: Whoops, I forgot to get the latest Thematic, duh. Give me a sec.

    Edit 2: I'm sorry, but I'm not familiar with what I need to do to download Thematic from the link you supplied. Could you give a little further instruction please, on what to do after I arrive at Google Code. Excuse my "Noob-ness" and thanks.

    Posted 5 years ago #
  8. Fast: Send an email to chris (at) wupperpiraten (dot) de .. will zip & email the current version plus my code for the functions.php ..

    A bit slower: Try tortoisesvn.tigris.org

    Cheers,

    Chris

    Posted 5 years ago #
  9. I unzipped and uploaded the latest Thematic you sent, (thanks!) then I unzipped and renamed "my_code" to functions.php (I have not yet had need for a functions.php in my child theme because all of the changes I have made have been to the CSS.) and saved as all files (ANSI) but when I went it to activate the plug-in I got this error and a blank page:

    Parse error: syntax error, unexpected '}' in ../wp-content/themes/legendscrazy.net/functions.php on line 31

    Posted 5 years ago #
  10. Sorry didn't know that you have no functions.php .. ok .. add:

    <?php

    at the beginning of the first line.

    Then it should work.

    Cheers,

    Chris

    Posted 5 years ago #
  11. I think it's not reacting well with one of my plug-ins now because I'm getting this now:

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at ../wp-content/themes/legendscrazy.net/functions.php:2) in ../wp-content/plugins/woopra/woopra.php on line 17

    the side bar is totally gone, the content is all jumbled and that error message appears at the top of the page.

    Sorry for all of the trouble Chris.

    Posted 5 years ago #
  12. .. Currently testing

    Posted 5 years ago #
  13. Sent an email with my functions.php

    Posted 5 years ago #
  14. Got it and it's working now! Thanks Chris! How do I control where the numbers show up? Is that done with css? It is showing up at the bottom of the comment instead of in the margin by the avatar.

    http://legendscrazy.net/poll-results/#comments

    Posted 5 years ago #
  15. Thanks so much for all of your help with this Chris! I really appreciate it. Thematic support is tops in my book! Here is the last functions.php you sent to me in case someone else can use the information.

    <?php
    function my_comments($comment, $args, $depth) {
        $GLOBALS['comment'] = $comment;
    	$GLOBALS['comment_depth'] = $depth;
        ?>
        	<li id="comment-<?php comment_ID() ?>" class="<?php thematic_comment_class() ?>">
    				<?php echo gtcn_comment_numbering($comment->comment_ID, $args); ?>
        		<div class="comment-author vcard"><?php thematic_commenter_link() ?></div>
        		<div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'thematic'),
        					get_comment_date(),
        					get_comment_time(),
        					'#comment-' . get_comment_ID() );
        					edit_comment_link(__('Edit', 'thematic'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>'); ?></div>
        <?php if ($comment->comment_approved == '0') _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'thematic') ?>
                <div class="comment-content">
            		<?php comment_text() ?>
        		</div>
    
    			<?php // echo the comment reply link with help from Justin Tadlock http://justintadlock.com/ and Will Norris http://willnorris.com/
    				if($args['type'] == 'all' || get_comment_type() == 'comment') :
    					comment_reply_link(array_merge($args, array(
    						'reply_text' => __('Reply','thematic'),
    						'login_text' => __('Log in to reply.','thematic'),
    						'depth' => $depth,
    						'before' => '<div class="comment-reply-link">',
    						'after' => '</div>'
    					)));
    				endif;
    			?>
    <?php }
    
    function my_callback() {
    	$content = 'type=comment&callback=my_comments';
    	return $content;
    }
    add_filter('list_comments_arg', 'my_callback');
    
    ?>

    Also, the div class is .commentnumber

    Posted 5 years ago #
  16. Thank you so much Chris! This is exactly what I needed. :) You rock!

    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.