ThemeShaper Forums » Thematic


Comment Layout

(10 posts)
  • Started 14 years ago by mr.macian
  • Latest reply from nono_kaki
  • This topic is not resolved
  1. mr.macian

    I've moved to thematic 0.9.5, and now I have a question regarding comment layout. I would like to change the default comment layout. For example, I would like to move both the comment author name and reply link inside the "comment-meta" div, leaving only the gravatar inside the "comment-author vcard" div. Any pointers on how to easily change the layout for comments?

    Posted 14 years ago #
  2. vijayrajesh

    OMG, no replies for 10 months?

    hmm, i have similar question. Any one there to reply please?

    Posted 13 years ago #
  3. iCristiano

    I underestand that the Thematic comments functions can´t be easly filtered or hookered like others... the principal one, the one that makes the comment layout thematic_comments() don´t have a filter option...

    So, the solution is to create a whole new comments zone, by comments.php right?

    Posted 12 years ago #
  4. What do you need?


    Posted 12 years ago #
  5. check out this:
    it is admittedly a little confusing (ok a lot confusing) ,however, so i can't guarantee it will actually help.

    i don't know if this will help either, but i did some pretty modifications of the comments:

    here is all the code i used:

     * Comments
    // Changes the standard text 'Post a Comment'
    function childtheme_postcomment_text() {
        $content = __('Leave a Comment', 'thematic');
        return $content ;
    // Custom callback to list comments in my style
    function child_comments($comment, $args, $depth) {
        $GLOBALS['comment'] = $comment;
    	$GLOBALS['comment_depth'] = $depth;
        	<li id="comment-<?php comment_ID() ?>" class="<?php thematic_comment_class() ?>">
        		<?php thematic_abovecomment() ?>
        		<?php thematic_commentmeta(TRUE); ?>
        <?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">
    			<span class="speech-bubble"></span>
            		<?php comment_text() ?>
    			<?php // echo the comment reply link with help from Justin Tadlock and Will Norris
    				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>'
    			<?php thematic_belowcomment() ?>
    <?php }
    	// Creates comment meta
    	function childtheme_override_commentmeta($print = TRUE) {
    	global $comment_count;
    		$content = '<div class="comment-meta">' . sprintf( __(' %1$s on <a href="%2$s" title="Permalink to this comment">%3$s at %4$s</a>', 'thematic' ),
    					'#comment-' . get_comment_ID(),
    					get_comment_time() );
    		if ( get_edit_comment_link() ) {
    			$content .=	sprintf(' <span class="meta-sep">|</span><span class="edit-link"> <a class="comment-edit-link" href="%1$s" title="%2$s">%3$s</a></span>',
    						__( 'Edit comment' ),
    						__( 'Edit', 'thematic' ) );
    		$content .= '</div>' . "\n";
    		return $print ? print(apply_filters('thematic_commentmeta', $content)) : apply_filters('thematic_commentmeta', $content);
    	} // end thematic_commentmeta
    	// Produces a link for comment author without avatar
    function child_commenter_link() {
    	$commenter = get_comment_author_link();
    	if ( ereg( '<a[^>]* class=[^>]+>', $commenter ) ) {
    		$commenter = ereg_replace( '(<a[^>]* class=[\'"]?)', '\\1url ' , $commenter );
    	} else {
    		$commenter = ereg_replace( '(<a )/', '\\1class="url "' , $commenter );
    	return ' <span class="fn n">' . $commenter . '</span>';
    } // end thematic_commenter_link
    function my_callback() {
        $content = array ('type' => 'comment',
    						'callback' => 'child_comments');
        return $content;
    add_filter('list_comments_arg', 'my_callback');
    function child_commentbox_text() {
    	$content = __('', 'thematic');
    	return $content;
    Posted 12 years ago #
  6. pritee

    Hi I am using thematic theam for my blog and i want to add new field in post a comment form which is now coming out this way (see below) I just wanted to add new fields like city or country how can i do this please help...
    Name *

    Email *



    Posted 12 years ago #
  7. pritee- i think you should have started a new topic. yeah it is comments related, but it is a different question than the OP. also maybe i am just grumpy this morning, but all the "please help" posts get on my nerves. obviously you want help or you wouldn't have posted. the forum will get to you in its own time and so pleading for assistance doesn't get you help any sooner.

    anyway, digging into the extensions folder... please take a look around. that is where you will learn how thematic is working!! there is a comments-extensions.php and i think that is what we're after, b/c inside that is a function that builds the comment form you are wanting to edit.

    the function is called thematic_comment_form_args.

    and it has a variable called $fields that is an array of the current form fields! perfect, that tells me we need to set up a filter to modify that variable.

    function add_city_to_comment_form($fields){
      $fields['city'] = '<div id="form-section-url" class="form-section"><div class="form-label"><label for="url">' . __( 'City', 'thematic' ) . '</label></div>' . '<div class="form-input"><input id="url" name="city" type="text" value="' . esc_attr( $commenter['comment_author_city'] ) . '" size="30" maxlength="50" tabindex="5" /></div></div><!-- #form-section-url .form-section -->',
      return $fields;


    i haven't tested anything so your mileage may vary. i can already see that $commenter['comment_author_city'] is never going to have a value b/c it won't exist in the $commenter variable of the original function.. which is defined by the wordpress function: wp_get_current_commenter and only has name, email and url. i suppose you could filter this somehow? i'm not sure. i also don't know how this info is saved so i don't know how you will use that info later on in the comments.

    basically i hate the comments. it is my least favorite thing to deal w/ in WP b/c it is by far the most difficult.

    Posted 12 years ago #
  8. Hi all,
    I'm from Indonesia, nice to meet you all.

    I wanna add the target attribute on function thematic_commenter_link() but I don't know how to.

    Anyone please help me??

    Sorry for my bad english

    Thanks before

    Posted 12 years ago #
  9. nono_kaki, nice to meet you too. please create your own thread with your specific question (which is different from the original question of this thread)- you will probably get a better response.

    Posted 12 years ago #
  10. @helgatheviking
    Thanks for the suggestion. :D

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.