Home>Support>Link from Comment opening in a new window

Link from Comment opening in a new window

Hi There,

When someone comments on my blog, they can input the URL to their own site for others to click on if they want to, which is great! But it would be nice if I could set this to open in a new window rather than navigate away from my page. I have checked the settings available in wordpress and I can’t see anything that helps, is there any tinkering I can do to make this possible? I’ve linked a post below that has comments on it.

Many Thanks

Lauren

URL: http://laurencariscooks.com/chai-tea-spiced-cupcakes/

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 7 months ago Andrew Misplon
    Hi, I Work Here

    Hey Lauren

    Is there a functions.php file in your child theme? Try this in functions:

    /**
     *  Comments template.
     */
    
    if ( ! function_exists( 'vantage_comment' ) ) :
    /**
     * Template for comments and pingbacks.
     *
     * Used as a callback by wp_list_comments() for displaying the comments.
     *
     * @since vantage 1.0
     */
    function vantage_comment( $comment, $args, $depth ) {
    	$GLOBALS['comment'] = $comment;
    	switch ( $comment->comment_type ) :
    		case 'pingback' :
    		case 'trackback' :
    			?>
    			<li class="post pingback">
    				<?php _e( 'Pingback:', 'vantage' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'vantage' ), ' ' ); ?>
    
    
    			<?php
    			break;
    		default :
    			?>
    			<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
    				<article id="comment-<?php comment_ID(); ?>" class="comment">
    					<footer>
    						<?php echo get_avatar( $comment, 50 ); ?>
    						<div class="comment-author">
    							<cite class="fn"><a href="<?php comment_author_url(); ?>" target="about_blank"><?php comment_author(); ?></a></cite>
    						</div><!-- .comment-author -->
    
    
    						<div class="comment-meta commentmetadata">
    							<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><time datetime="<?php comment_time( 'c' ); ?>"><?php
    								/* translators: 1: date, 2: time */
    								printf( __( '%1$s at %2$s', 'vantage' ), get_comment_date(), get_comment_time() );
    								?></time></a>
    
    							<span class="support">
    								<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    								<?php edit_comment_link( __( 'Edit', 'vantage' ), ' ' ); ?>
    							</span>
    						</div><!-- .comment-meta .commentmetadata -->
    
    						<?php if ( $comment->comment_approved == '0' ) : ?>
    							<em class="awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'vantage' ); ?></em>
    						<?php endif; ?>
    					</footer>
    
    					<div class="comment-content entry-content"><?php comment_text(); ?></div>
    				</article><!-- #comment-## -->
    		
    			<?php
    			break;
    	endswitch;
    }
    endif; // ends check for vantage_comment()
    
  2. 9 years, 7 months ago Andrew Misplon
    Hi, I Work Here

    These guys are talking about what I’ve done:

    https://wordpress.org/support/topic/how-do-i-make-the-commentors-name-link-open-in-new-window

  3. 9 years, 7 months ago Ben Short

    On behalf of Lauren (I’m her husband / live-in-tech-support)… thanks Andrew – this works a charm!

    • 9 years, 7 months ago Greg Priday
      Hi, I Work Here

      That made me smile. I’m currently a live-in-tech-support boyfriend. One day I hope I’ll get a promotion ;) Until WordPress do us part.

      • 9 years, 7 months ago Ben Short

        Haha I think all of us in our situation are hoping for that promotion! :)

    • 9 years, 7 months ago Andrew Misplon
      Hi, I Work Here

      Super, glad to hear that did the trick :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More