WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] New comment form issue (3 posts)

  1. Michael Johansen
    Member
    Posted 1 year ago #

    I have troubles with the header in the new comment form.

    I have the following in my function php:

    <header class="comment-meta comment-author vcard">
    				<?php
    					echo get_avatar( $comment, 44 );
    					printf( '<cite class="fn">%1$s %2$s</cite>',
    						get_comment_author_link(),
    						// If current post author is also comment author, make it known visually.
    						( $comment->user_id === $post-> post_author ) ? '<span class="commentAuthor"> ' . __( 'Post author', 'my_blog_name_here' ) . '</span>' : ''
    					);
    					printf( '<a href="%1$s"><br /><time 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', 'my_blog_name_here' ), get_comment_date() )
    					);
    				?>
    			</header>

    What I want is to:

      Remove the difference between the post author and everyone else.
      Have the (output of the ) author and the date of comment in two lines.
      Have the author and the date in two different < span class="" >
      To be sure I haven't messed up the above code already.

    Would anyone please look into this and help out. I have really really tried the best myself already....

    Regards,

    :)

    *****

    I build the theme at local server, but it is partly live @ http://www.michaelsweightlosstips.com/test-article-1

  2. bcworkz
    Member
    Posted 1 year ago #

    This should work for you, but it is untested.

    <header class="comment-meta comment-author vcard">
    				<?php
    					echo get_avatar( $comment, 44 );
    					printf( '<span class=""><cite class="fn">%1$s</cite></span><br>', get_comment_author_link() );
    					printf( '<span class=""><a href="%1$s"><time datetime="%2$s">%3$s</time></a></span>',
    						esc_url( get_comment_link( $comment->comment_ID ) ),
    						get_comment_time( 'c' ),
    						/* translators: 1: date, 2: time */
    						sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )
    					);
    				?>
    			</header>
  3. Michael Johansen
    Member
    Posted 1 year ago #

    bcworkz,

    Absolutely great, thank you!

    The cleaned up code you provided has solved my problem, and has been sent to work.

    Regards,

    Michael

Topic Closed

This topic has been closed to new replies.

About this Topic