WordPress.org

Ready to get started?Download WordPress

Forums

Comments - Author URL & Content URLs to open in a new window (3 posts)

  1. CodeCritic
    Member
    Posted 6 years ago #

    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

  2. CodeCritic
    Member
    Posted 6 years ago #

    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);
    }
  3. CodeCritic
    Member
    Posted 6 years ago #

    Any help on issue 2 please?

Topic Closed

This topic has been closed to new replies.

About this Topic