Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages » Comments, trackbacks & pings »

[SOLVED] Open Comment Author link in new window


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Sep 25, 2009, 08:19 AM
Larry
 
37 posts · Sep 2009
[SOLVED] Open Comment Author link in new window

I would like to have the hyperlink for the Author of any comment who provides a website url, to open in a new window. I searched the forum here already with no luck.

I know I can use target="_blank" but can't find where the best place to add this would be.
  #2  
Old Sep 25, 2009, 06:53 PM
Larry
 
37 posts · Sep 2009
Never mind, I got it taken care of.
  #3  
Old Sep 26, 2009, 06:49 AM
juggledad's Avatar
juggledad
 
22,187 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
Mind explaining your solution to help someone else that might want to do this?
__________________
Give a person a solution, you fix one issue, teach a person how to solve their problem you enable them forever.
Juggledad | Forum Moderator/Support
  #4  
Old Sep 26, 2009, 07:53 AM
Larry
 
37 posts · Sep 2009
Certainly, as soon as I remember what I did
Once I get started on something, I can't seem to stop. I know I spent quite a while getting ti to work. I will go through my notes and post back what I did.
  #5  
Old Sep 26, 2009, 08:26 AM
Larry
 
37 posts · Sep 2009
Okay, here's what I did (if there is an easier way or better way, please correct my post):

1) Logged in to C-Panel to get access to wp-includes/comment-template.php
2) Opened up comment-template.php using the code editor in C-Panel
3) Located the function get_comment_author_link which was on line 148 in my file
4) Here is what the code looked like before I made the change:
Code:
function get_comment_author_link() {
	/** @todo Only call these functions when they are needed. Include in if... else blocks */
	$url    = get_comment_author_url();
	$author = get_comment_author();

	if ( empty( $url ) || 'http://' == $url )
		$return = $author;
	else
		$return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
	return apply_filters('get_comment_author_link', $return);
}
5) Here is what it looked like after I added target='_blank'
Code:
function get_comment_author_link() {
	/** @todo Only call these functions when they are needed. Include in if... else blocks */
	$url    = get_comment_author_url();
	$author = get_comment_author();

	if ( empty( $url ) || 'http://' == $url )
		$return = $author;
	else
		$return = "<a href='$url' rel='external nofollow' class='url' target='_blank'>$author</a>";
	return apply_filters('get_comment_author_link', $return);
}
6) Save the edited file in C-Panel and then preview a page with a comment on it to make sure it works.

Last edited by juggledad; Nov 9, 2009 at 06:39 AM. Reason: fixed error in code

Bookmarks

Tags
author hyperlink, comments link

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open RSS in New Window? adum RSS, Feeds & Subscribing 6 Jan 12, 2010 06:19 PM
Make external links open in a new window clarge Header configuration & styling 1 Aug 9, 2009 03:00 PM
comment author link... designer666 Comments, trackbacks & pings 1 May 11, 2009 01:23 PM
Byline link opening in new window ronald73 Post-Kicker, -Byline & -Footer 2 May 6, 2009 01:55 AM
How to cause Page menu items to open in same window? joe hark Page & Category Menu Bars 1 Mar 2, 2009 03:49 AM


All times are GMT -6. The time now is 10:01 PM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.