WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Styling Comments

[Resolved] Styling Comments

  • UnfinishedSympathy
    Member

    @unfinishedsympathy

    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 !

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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() )
    			)
    		);
    UnfinishedSympathy
    Member

    @unfinishedsympathy

    It works great ! Thank you very much !

    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.

    UnfinishedSympathy
    Member

    @unfinishedsympathy

    yes, I forgot it. It’s done. Thanx again 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Styling Comments’ is closed to new replies.