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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
eevan79 Posted December 4, 2009 Author Share Posted December 4, 2009 JAY6390 it works. Thanks! Regards, Ivan Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted December 4, 2009 Share Posted December 4, 2009 Cool, no probs Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.