Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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


  #1  
Old Sep 25, 2009, 09:19 AM
Larry
 
37 posts · Sep 2009
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, 07:53 PM
Larry
 
37 posts · Sep 2009
Never mind, I got it taken care of.
  #3  
Old Sep 26, 2009, 07:49 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Mind explaining your solution to help someone else that might want to do this?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #4  
Old Sep 26, 2009, 08: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, 09: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 07:39 AM. Reason: fixed error in code

Bookmarks

Tags
author hyperlink, comments link



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


All times are GMT -6. The time now is 04:23 PM.


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