WordPress.org

Support

Support » How-To and Troubleshooting » Comments – Author URL & Content URLs to open in a new window

Comments – Author URL & Content URLs to open in a new window

  • I am using wordpress 2.5 and on my blog, the following open up in the same window. I want these 2 to be opened up in new window.

    1. Comments author URL and
    2. URLs posted as Comment data

    Appreciate any help on this.
    http://codecritic.in

Viewing 2 replies - 1 through 2 (of 2 total)
  • I figured out the solution for issue 1:

    Change this file : ../wp-includes/comment-template.php as below:

    function get_comment_author_link() {
    	$url    = get_comment_author_url();
    	$author = get_comment_author();
    
    	if ( empty( $url ) || 'http://' == $url )
    		$return = $author;
    	else
    		$return = "<a href='$url' rel='external nofollow'>$author</a>";
    	return apply_filters('get_comment_author_link', $return);
    }

    ——————————————————————
    Change the code which looks similar to above with a small change as below. This basically introuduces target=’_blank’ and nothing more!
    ——————————– ———————————-

    function get_comment_author_link() {
    	$url    = get_comment_author_url();
    	$author = get_comment_author();
    
    	if ( empty( $url ) || 'http://' == $url )
    		$return = $author;
    	else
    		$return = "<a href='$url' rel='external nofollow' target='_blank'>$author</a>";
    	return apply_filters('get_comment_author_link', $return);
    }

    Any help on issue 2 please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Comments – Author URL & Content URLs to open in a new window’ is closed to new replies.
Skip to toolbar