eevan79 Posted December 4, 2009 Share Posted December 4, 2009 Hi, I have simple problem. I want to open php code in new window. Here is my code: <li><?php comment_author_link() ?> </li> How to open this comment_author_link in new window? Thanks. Link to comment https://forums.phpfreaks.com/topic/183928-simple-open/ Share on other sites More sharing options...
JAY6390 Posted December 4, 2009 Share Posted December 4, 2009 Not possible to do unless you modify the wordpress core files, and I'd strongly recommend not doing that Link to comment https://forums.phpfreaks.com/topic/183928-simple-open/#findComment-970954 Share on other sites More sharing options...
JAY6390 Posted December 4, 2009 Share Posted December 4, 2009 Well I didnt think of it til just now but you can do this with a plugin. Create a new file called comment-author-edit.php in the wp-content/plugins/ folder, and put the following in it <?php /* Plugin Name: Edit Comment Author Version: 0.1 Description: Automatically adds target="_blank" to comment author links Author: Jay Gilford Author URI: http://www.jaygilford.com/ Plugin URI: http://www.jaygilford.com/ */ /* Version Check */ global $wp_version; $exit_message = 'This plugin requires Wordpress 2.5 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please Update!</a>'; if(version_compare($wp_version, '2.5', '<')) { exit($exit_message); } /* FILTERS */ add_filter('get_comment_author_link', 'comment_author_link_edit'); function comment_author_link_edit($content) { $content = str_replace('<a ', '<a target="_blank"', $content); return $content; } Save it, then look for Edit Comment Author in your plugin menu in the dashboard, and enable it Link to comment https://forums.phpfreaks.com/topic/183928-simple-open/#findComment-970965 Share on other sites More sharing options...
eevan79 Posted December 4, 2009 Author Share Posted December 4, 2009 JAY6390 it works. Thanks! Regards, Ivan Link to comment https://forums.phpfreaks.com/topic/183928-simple-open/#findComment-971372 Share on other sites More sharing options...
JAY6390 Posted December 4, 2009 Share Posted December 4, 2009 Cool, no probs Link to comment https://forums.phpfreaks.com/topic/183928-simple-open/#findComment-971373 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.