Home Blog How to Make Wordpress Blog Posts Open in a Blank Window.

How to Make WordPress Blog Posts Open in a Blank Window.

MashTips is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission at no extra cost to you.

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 are 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 texts in it. After creating 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 functioning 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.

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

After modifying the given line in the position, just read above and below lines to match with the one in the 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 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 Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Free Newsletter


7 Best Tips to Stop Facebook From Draining Your Phone Battery?

iPhone and Android users feel that both Facebook and Messenger apps suck more power, even if they are running in the background. No doubt,...

Top 10 features of Windows 10: A new OS or Old?

Microsoft has unveiled its new OS called Windows 10 on 30th Sep 14, instead of a widely expected Windows 9. This time, Microsoft did...

iOS Autofill Passwords: How to Set up on iPhone and Use?

Are you getting sick of remembering too many passwords? iOS devices have a good feature to help you out. With the Autofill Passwords feature...

How to Sync Google Secondary Calendars on iPhone /iPod?

Google Secondary Calendars are essential if you are using to schedule your school, business events as a separate entry. Secondary Calendars are better choice...

How to Soft / Hard reset Nokia Phone?

Do you feel your Nokia phone isn't working properly or not responding quickly? Are you having weird problems that you didn't have when you...

Best Clipboard Manager Windows Tools for Efficiency

We often copy scraps of data around for easy pasting  and it is a daily routine for us to move several layers of data...