- This topic has 4 replies, 2 voices, and was last updated 7 years, 5 months ago by
Tom.
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
April 10, 2016 at 3:47 am #185675April 10, 2016 at 11:02 pm #185801
Tom
Lead DeveloperLead DeveloperInteresting, can you confirm that the same block of code is working in the Twenty Sixteen theme?
April 11, 2016 at 12:22 am #185847Pete
Nope not working in any theme? What piece of
template-tag.php
code would I need to use this code below to link the author name to their profile page? (ALL users are authors)<a href ="<?php bloginfo('url'); ?>/?author=<?php echo $comment->user_id ?>"><?php echo $comment->comment_author?></a>
April 11, 2016 at 12:33 am #185848Pete
Found it…
paste the follow part of template-tags.php into your child theme functions.php
I replaced<?php printf( '<cite class="fn">%s</cite>', get_comment_author_link() ); ?>
with<a href ="<?php bloginfo('url'); ?>/?author=<?php echo $comment->user_id ?>"><?php echo $comment->comment_author?></a>
if ( ! function_exists( 'generate_comment' ) ) : /** * Template for comments and pingbacks. * * Used as a callback by wp_list_comments() for displaying the comments. */ function generate_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; $args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 ); if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?> <li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>> <div class="comment-body"> <?php _e( 'Pingback:', 'generatepress' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?> </div> <?php else : ?> <li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>> <article id="div-comment-<?php comment_ID(); ?>" class="comment-body"> <footer class="comment-meta"> <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?> <div class="comment-author-info"> <div class="comment-author vcard"> <a href ="<?php bloginfo('url'); ?>/?author=<?php echo $comment->user_id ?>"><?php echo $comment->comment_author?></a> </div><!-- .comment-author --> <div class="entry-meta comment-metadata"> <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"> <time datetime="<?php comment_time( 'c' ); ?>"> <?php printf( _x( '%1$s at %2$s', '1: date, 2: time', 'generatepress' ), get_comment_date(), get_comment_time() ); ?> </time> </a> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?> <?php comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '<span class="reply">| ', 'after' => '</span>', ) ) ); ?> </div><!-- .comment-metadata --> </div><!-- .comment-author-info --> <?php if ( '0' == $comment->comment_approved ) : ?> <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'generatepress' ); ?></p> <?php endif; ?> </footer><!-- .comment-meta --> <div class="comment-content"> <?php comment_text(); ?> </div><!-- .comment-content --> </article><!-- .comment-body --> <?php endif; } endif; // ends check for generate_comment()
-
This reply was modified 7 years, 5 months ago by
Pete.
April 11, 2016 at 8:19 am #185924Tom
Lead DeveloperLead DeveloperThat’ll do it, glad you found a solution 🙂
-
This reply was modified 7 years, 5 months ago by
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.