WordPress.org

Ready to get started?Download WordPress

Forums

Adding Comment Numbering to Twenty Ten (8 posts)

  1. glutenfreerecipebox
    Member
    Posted 1 year ago #

    I am using Twenty Ten theme and wish to add comment numbering. I already have the total number of comments showing, but I wish to show individual numbering. This will help me with choosing a giveaway winner using random.org.

    I already tried uploading Greg's Threaded Numbering Comments Plugin, but I don't know what to change in Twenty Ten or which files to change. I have tried some suggestions for other themes, but they do not work in Twenty Ten.

    Any help would be appreciated.

    My blog: glutenfreerecipebox.com

  2. johnbhartley
    Member
    Posted 1 year ago #

    In your file style.css look at line 947. You should see .commentlist with the following code inside

    .commentlist {
    	list-style: none;
    	margin: 0;
    }

    Take all of that out and you should get numbers next to each comment. Comments are in an ordered list, which means as long as you let them have the default style, the numbers will show.

  3. glutenfreerecipebox
    Member
    Posted 1 year ago #

    johnbhartley,

    Thanks. That's the closest I've gotten so far, but it numbers each page 1-10 and starts over again 1-10 on the next page. Thanks though. I'm getting closer!

  4. johnbhartley
    Member
    Posted 1 year ago #

    You may be able to change whether comments are paged or not under Dashboard -> Settings -> Discussion

  5. glutenfreerecipebox
    Member
    Posted 1 year ago #

    No. I do not have that option. I have the Twenty Theme, and a customized theme my IT guy named Thirty Ten. I actually have two sets of files. Some in Thirty Ten override the ones in Twenty Ten.

    I think I'll just use the free plugin And the Winner Is until I sort this out. Yesterday I really needed numbered comments, as I had a giveaway with almost 350 comments. I had to count them until I reached the winner, comment 224. What a pain!

    Thanks again!

    If you know anything about Twenty Ten theme please let me know. From what I've read I will need to adjust things in possibly the Comments, Function or Loop; and then CSS files.

  6. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    and a customized theme my IT guy named Thirty Ten.

    btw - 'Thirty Ten' is a free downloadable child theme of Twenty Ten - and that child theme does actually do nothing to the comments.

    you could change the settings under:

    dashboard - settings - discussion - and untick 'Break comments into pages with [ ] top level comments per page and the [ ] page displayed by default'

    however, with 350 comments, this would make a very long comments list...

    generally:
    you probably could use "Greg's Threaded Comment Numbering" plugin;
    however, you need to add this code to the bottom of functions.php of Thirtyten first:

    function twentyten_comment( $comment, $args, $depth ) {
    	$GLOBALS['comment'] = $comment; 
    
    	switch ( $comment->comment_type ) :
    		case '' :
    	?>
    	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
    		<div id="comment-<?php comment_ID(); ?>">
    
    		<?php
    		//added for comment numbering with 'Greg's Threaded Comment Numbering' plugin -
    		//http://wordpress.org/extend/plugins/gregs-threaded-comment-numbering/
    		if( function_exists('gtcn_comment_numbering') ) gtcn_comment_numbering($comment->comment_ID, $args); ?>
    
    		<div class="comment-author vcard">
    			<?php echo get_avatar( $comment, 40 ); ?>
    			<?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
    		</div><!-- .comment-author .vcard -->
    		<?php if ( $comment->comment_approved == '0' ) : ?>
    			<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
    			<br />
    		<?php endif; ?>
    
    		<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
    			<?php
    				/* translators: 1: date, 2: time */
    				printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
    			?>
    		</div><!-- .comment-meta .commentmetadata -->
    
    		<div class="comment-body"><?php comment_text(); ?></div>
    
    		<div class="reply">
    			<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    		</div><!-- .reply -->
    	</div><!-- #comment-##  -->
    
    	<?php
    			break;
    		case 'pingback'  :
    		case 'trackback' :
    	?>
    	<li class="post pingback">
    		<p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p>
    	<?php
    			break;
    	endswitch;
    }
  7. glutenfreerecipebox
    Member
    Posted 1 year ago #

    Hello alchymyth,

    Thank you for taking the time to provide me with all of this information.

    I do understand that Thrity Ten is a downloadable theme. He just customized it to my specs.

    Once again, I downloaded Greg's Threaded Comment Numbering, but did not activate it until I added the above code you suggested to the bottom of the Thirty-Ten function.php file. Upon trying to activate the plugin I got a server error. I tried another page on my blog and it also had the same server error. Once I removed the code from the bottom of the function.php file the error disappeared. I am wondering if the code I added to ignore comments on pages is interfering with the code you provide above. Here's the code I have at the bottom of the functions file now:

    }
    
    add_action( 'after_setup_theme', 'thirtyten_setup' );
    
    add_filter( 'comments_template', 'remove_comments_template_on_pages', 14575, 10221);
    
    function remove_comments_template_on_pages( $file ) {
    if ( is_page() )
    $file = STYLESHEETPATH . '/no-comments-please.php';
    return $file;
    }
    
    add_action ('genesis_before_comment', 'child_numbered_comments');
    function child_numbered_comments () {
        if (function_exists('gtcn_comment_numbering'))
        echo gtcn_comment_numbering($comment->comment_ID, $args);
    }
    
    require_once('text-wrangler.php');
    add_filter('gettext', array('Thirty_Ten_Text_Wrangler', 'site_generator'), 10, 4);
    add_filter('gettext', array('Thirty_Ten_Text_Wrangler', 'single_meta'), 10, 4);
    
    require_once( STYLESHEETPATH . '/options.php');
  8. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    add_action ('genesis_before_comment', 'child_numbered_comments');

    are you using a 'genesis' theme?

    afaik, ThirtyTen does not have this action hook.

    did you try adding the full suggested code to functions.php of ThirtyTen?

Topic Closed

This topic has been closed to new replies.

About this Topic