links in commentators' names (7 posts)

  1. akhmatullina
    Posted 2 years ago #

    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?

  2. Luigi Petrut
    Posted 2 years ago #

    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.

  3. akhmatullina
    Posted 2 years ago #

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

  4. barnez
    Posted 2 years ago #

    @ 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.

  5. akhmatullina
    Posted 2 years ago #

    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?

  6. barnez
    Posted 2 years ago #

    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.

  7. akhmatullina
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic