Open Notifcation Links in New Tab
-
How can I open manually added notifications in a new tab?
target=”_blank” type thing
-
I read this thread:
(@jorisbudel)
Would be nice if links could be opened in new tabs with target=”_blank”.
(@wpdever)
Hi,
Thanks for your suggestion. I’ll add this option in the next update.
—-
But it doesn’t appear it was ever added to the plugin.. unless I’m missing something.
Hi,
I’ve just added the filter to be used for this. You can update the plugin then in your theme’s functions.php file, add:
add_filter('wnbell_link_target', function ($target) {
return '_blank'; // Open all links in a new tab
});Thanks for the reply, @wpdever
I updated the plugin and added that code to my functions.php file but the links still do not open in a new tab..
If you click the bell in the main menu, you’ll see they still do not. Cleared my cache, and browser cache to make sure.. https://nagolbud.com/
Thanks for the reply, @wpdever
I updated the plugin and added that code to my functions.php file but the links still do not open in a new tab.. I click the little bell in the main menu, drop down menu of manually added nonfictions, click, same tab.
.wnbell_notification_item_menu a
Could you please send the website link to wpnotificationbell@gmail.com and how to access the bell on the site?
Is the bell displayed by enabling the “Add bell icon to menu for visitors” option?
Can you add the code directly to the plugin’s wp-notification-bell.php at the bottom, just to test?
Yes @wpdever , both:
Add bell icon to menu for logged-in usersAdd bell icon to menu for visitors
Are enabled.
Adding the code directly to the bottom of wp-notification-bell.php does work now, they open in a new tab.
The code will disappear if you update the plugin in the future.
Can you check why it doesn’t work in functions.php? Maybe change the position of the code or verify if it’s the right theme.
I found the error.
I am using the plugin “Code Snippets” to add code to my functions.php file so I don’t have to open up hosting each time / get deleted in theme updates, and switching the options from:
- Only run code on site front-end
TO
- Run snippet everywhere
Fixed the problem. The links are now opening in a new tab correctly without having to manually place the code in the wp-notification-bell.php file.
All is good. Thanks for your help!
Glad it worked! And thanks for letting me know about this fix.
The topic ‘Open Notifcation Links in New Tab’ is closed to new replies.