Support » Themes and Templates » How To Add Target=”_bank” In Comments.php

  • Hello!

    Comment.php has this line of code:

    <cite><?php comment_author_link() ?></cite> Says:

    How do I use Target=”_blank” so that when people click on the names it opens the link in a new window?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try:

    <cite><a href="<?php comment_author_url(); ?>" target="_blank"><?php comment_author(); ?></a></cite>

    Sweet! Thank you, Kalon. Your code helped me with my blog!!

    I adjusted it to account for comment authors who don’t have a site address…

    echo '<cite>';
    
    if(get_comment_author_url())
    	{
    	echo '<a href="' . get_comment_author_url() .
    	'" target="_blank" title="Website of ' .
    	get_comment_author() . '">' . get_comment_author() . '</a>';
    	}
    else	{ comment_author(); }
    
    echo '</cite>';
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How To Add Target=”_bank” In Comments.php’ is closed to new replies.