WordPress.org

Forums

[resolved] Styling Comments (5 posts)

  1. UnfinishedSympathy
    Member
    Posted 2 years ago #

    Hello there,

    I use a child theme of TwentyEleven and I would like to make some changes on the comment display.
    For now, when displaying a comment, I have this as the first line:

    John Doe on 15th January 2013 at 07h45 said :

    and I would like to change it for something like this:

    John Doe
    15th January 2013

    It's all in functions.php:

    <?php
    	$avatar_size = 68;
    	if ( '0' != $comment->comment_parent )
    	$avatar_size = 39;
    
    	echo get_avatar( $comment, $avatar_size );
    
    	/* translators: 1: comment author, 2: date and time */
    	printf( __( '%1$s on %2$s <span class="says">said:</span>', 'twentyeleven' ),
    
    		sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
    		sprintf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
    		         esc_url( get_comment_link( $comment->comment_ID ) ),
    			get_comment_time( 'c' ),
    		        /* translators: 1: date, 2: time */
    				sprintf( __( '%1$s at %2$s', 'twentyeleven' ), get_comment_date(), get_comment_time() )
    			)
    		);
    ?>

    But can't make it works.
    Any help welcome !
    Thank you !

  2. vtxyzzy
    Member
    Posted 2 years ago #

    Try changing this:

    /* translators: 1: comment author, 2: date and time */
    	printf( __( '%1$s on %2$s <span class="says">said:</span>', 'twentyeleven' ),
    
    		sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
    		sprintf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
    		         esc_url( get_comment_link( $comment->comment_ID ) ),
    			get_comment_time( 'c' ),
    		        /* translators: 1: date, 2: time */
    				sprintf( __( '%1$s at %2$s', 'twentyeleven' ), get_comment_date(), get_comment_time() )
    			)
    		);

    to this:

    /* translators: 1: comment author, 2: date */
    	printf( __( '%1$s <br /> %2$s', 'twentyeleven' ),
    
    		sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
    		sprintf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
    		         esc_url( get_comment_link( $comment->comment_ID ) ),
    			get_comment_time( 'c' ),
    		        /* translators: 1: date */
    				sprintf( __( '%1$s', 'twentyeleven' ), get_comment_date() )
    			)
    		);
  3. UnfinishedSympathy
    Member
    Posted 2 years ago #

    It works great ! Thank you very much !

  4. vtxyzzy
    Member
    Posted 2 years ago #

    If your problem has been solved, please use the dropdown on the right to mark this topic 'Resolved' so that anyone else with this question can see that there is a solution.

  5. UnfinishedSympathy
    Member
    Posted 2 years ago #

    yes, I forgot it. It's done. Thanx again ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags