Support » How-To and Troubleshooting » links in commentators' names

links in commentators' names

  • ok, how do i explain it better? when people who comment on my blog add their website when submitting their comments, their name becomes clickable. the problem is that when you click on their name their website doesn’t open in a new window, it opens in the same window, so users will leave my website then. i don’t want this to happen. how do i make their websites open in a new window?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I recommend you to use a child theme.

    NOTE: Replace theme-name with your theme’s name (e.g. twentyfourteen).
    NOTE: Replace Theme Name Child with your theme’s name (e.g. Twenty Fourteen Child).

    1. Create a new directory called theme-name-child in the themes directory.
    2. Create a new file called style.css in the theme-name-child directory.
    3. Paste the code below in the style.css file.

    Theme Name: Theme Name Child
    Template: theme-name
    @import "../theme-name/style.css";

    4. Create a new file called functions.php in the theme-name-child directory.
    5. Paste the code below in the functions.php file.

    function open_comment_author_link_in_new_window($link)
    	$link = str_replace('<a', '<a target="_blank"', $link);
    	return $link;
    add_filter('get_comment_author_link', 'open_comment_author_link_in_new_window');

    6. Activate the child theme from your Dashboard.

    thanks, Luigi, but this looks a bit complicated for me. what exactly is happening in this process. could you explain? thanks

    @ akhmatullina

    Creating a child theme is recommended if you want to make theme-based changes to the site without running the risk of breaking or damaging your theme.

    These changes are usually to the functions.php file (to change how your theme works), or to the style.css file (to change your theme’s appearance). A further important advantage is that when your theme needs updating, only the parent theme will be be updated, and all your modifications will remain untouched in your child theme.

    Thanks Barnez. still a bit complicated but there is some more clarity.
    so, basically you’re saying that the issue i described depends on the theme? it doesn’t have anything to do with the website settings?

    Yes, this is a theme related issue, and nothing to do with your WordPress settings.

    If you make a backup first, and then follow @luigi Petrut’s instructions carefully, you will end up with a child theme that you can modify, without worrying about 1) breaking your parent theme by mistake, or 2) having your modifications overwritten when you update the parent theme.

    ok, that’s interesting.
    thanks. will try that. and hope i won’t mess up

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘links in commentators' names’ is closed to new replies.