Author comments hook
-
Hi Anders. Thanks for creating and maintaining the beautiful Hitchcock theme.
Feature request: Add a CSS class hook to allow styling of comments made by post authors, distinguishing them from comments made by readers.
In functions.php you currently have:
<h4 class="comment-title"> <?php echo get_comment_author_link(); ?> <span><a class="comment-date-link" href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>" title="<?php echo get_comment_date() . ' at ' . get_comment_time(); ?>"><?php echo get_comment_date( get_option( 'date_format' ) ); ?></a> <?php if ( $post == get_post( $post->ID ) ) { if ( $comment->user_id === $post->post_author ) echo ' — ' . __( 'Post Author', 'hitchcock' ); } ?> </span> </h4>There is probably a more elegant way to achieve it, but the replicating the if block used to output the POST AUTHOR text gets the job done. A simple addition along the lines of the following would allow users to style the H4 when it is the author replying.
<h4 class="comment-title<?php if ( $post == get_post( $post->ID ) ) { if ( $comment->user_id === $post->post_author ) echo ' author'; } ?>"> <?php echo get_comment_author_link(); ?> <span><a class="comment-date-link" href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>" title="<?php echo get_comment_date() . ' at ' . get_comment_time(); ?>"><?php echo get_comment_date( get_option( 'date_format' ) ); ?></a> <?php if ( $post == get_post( $post->ID ) ) { if ( $comment->user_id === $post->post_author ) echo ' — ' . __( 'Post Author', 'hitchcock' ); } ?> </span> </h4>The problem with trying to use the existing byuser hook is that while it successfully styles the first comment by the post author, all subsequent comments in the thread (regardless of whether or not they are made by the post author) are similarly styled.
The topic ‘Author comments hook’ is closed to new replies.
