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

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

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.

Disclaimer: 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.

Leave a Reply

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

Free Newsletter


How to Use Continuity Camera on Mac to Capture Photos Using iPhone

The Continuity Camera allows you to capture photos using iPhone or iPad and get the picture instantly on your Mac. When you want to...

How to get Rain or Snow Alert on Android or iPhone

You won't be stuck in rain or snow anymore. Your smartphone is able to alert you one day in advance if there has any...

How to Draw in Windows 10 Mail App

I am not a big fan of Outlook and so when I installed Windows 10 on my laptop, I was apprehensive, to say the...

You Can Now Play YouTube in Background on iPhone with iOS 14

YouTube means a lot for all of us, from the favorite Music player to the daily digest news source. But, it cannot play videos...

The Easiest Way to Edit PDFs on Mac with PDFelement.

We all work with files in PDF format in some way, but for some, this is the only way to establish a document flow...

How to Know Apple iMessage is Free or Not-Complete Guide

Apple's built-in texting app iMessage allows free texting across all iOS devices and Mac OS as long as they have internet access. Basically, iMessage...