Many of us will be thinking to change our WordPress blog post links to be opened in a new tab or window. Enabling this function is really easy in WordPress if you follow the described method here properly. Currently this function is not easily configurable in WordPress as of now. We may find out some plugin to do this simple task after a lot of search and query but it can be avoided using this method.

We are demonstrating the method using the Responz theme from Themify. The basic idea still remains valid for all the other themes except the file names and locations given for it. There will be a loop.php file in Responz theme which is collecting the post excerpts and displaying it on the main page as per your design.

We need to insert a single option in that page which will convert all your post links opening in the new window or tab. Before attempting anything in your site, be sure that you have a restorable backup in case of emergency. Also care should be taken to properly input the given lines as it is.

wordpress open new tab

To start with, we need to create a child theme of Responz. It is also an easy step that to create a folder named as “Responz-child” under your “themes” directory and inserting a “style.css” file with few text in it. After creation of the child theme, you must test it using your admin panel by activating it. After verifying the child theme, you need to create a folder called “includes” inside the child theme.

wordpress new tab

Now we will copy the “loop.php” file from the Responz theme into the “includes” folder inside the “Responz-child” folder. We may again test it for the proper functionality of the child theme before attempting the main change. wordpress new tab

After verification, we need to open the “loop.php” file inside the “Responz-child” theme folder which we copied from the source “Responz” folder. Make double sure that you are editing the “loop.php” file inside of the “Responz-child” folder and then find out the below given portion (highlighted in the picture as red-blue-red color) in the “loop.php” file. We need to type target=”_blank” line into the correct position (in the blue highlighted section) as given in the picture without any formatting and other modifications. wordpress new tabOtherwise you may copy and paste the below given line in the highlighted position to replace the old line of code.

<h1><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a></h1>

After modifying the given line in the position, just read above and below lines to match with the one in given picture to make sure the changes are incorporated properly. Now we have to save the file and activate the child theme again to make it effective. You may sometimes need to flush your cache in the settings to view the changes immediately. In each post heading, you can see the inserted target=”_blank” in the page source which makes it opening in the new window or tab.

This method is also applicable to the base Responz theme. Here we have taken a precautionary approach about the accidental errors while editing the “loop.php” file. In case of an error, the Responz-child theme may not become active which will indicate about errors. If you want to revert the changes, it is very easy to activate the parent Responze theme from the theme settings admin panel. You may also remove the added line from the correct position to disable this function permanently.

Leave a comment