How to open all links in Wordpress in a new tab? I am using a Child Theme of Sydney wordpress. I do not know coding. Thanks for any help
Open up your /index.php file and pop this within the <head> tag.
<base target="_blank">
P.S. If your not able to do this. It might be best to do at-least a tiny bit of research about web code and Wordpress.
If you want the menu items open in new tabs then there is an option for that in menu options. please see below images
tick link target option
open link in new tab
If you want all external links open in new tabs , then
I tried a few plugins for this, and “Open external links in a new window” was my favorite.Search it in plugin page, install it. It will work well. :)
jQuery
jQuery( document ).ready(function() {
jQuery("a").attr("target", "_blank");
});
without jQuery
<base target="_blank">
Related
Sometimes we see some page post on my timeline, where website shareing link conatin a image, below part of image attach with a page brand name (i have atatch a image example below.). if you click on link you will go to the website page and you will not see the brand name with image. I think somehow this brand name added later by coding or other system. I am confirm, content uploader does not attach this brand name with image, it happen automaticaly.
there anyone please tell me the system nmae and how to do it? at word press how can do that? have any plugin or code? thanks in advance.
You have to add the meta property inside the header area of your site. Please check below article to know more.
For Facebook
For Twitter
You can add meta properties like this.
add_action('wp_head','add_meta_tags');
function add_meta_tags() {
global $post;
echo '<meta property="og:title" content="'.$post->post_title.'" />';
// So on....
}
Hello I have the following problem: I have my website made in Wordpress, and I have a 3D Cover Carousel plugin there, which shows me a gallery of photos in 3d. The thing is that when I click on the image I want the link to be opened in a NEW tab. In the plugin settings there are no such an option. The plugin html is a short code added to my page. So the only thing I can change is Additional css. So is there any options to make a link be opened in a new tab only with css?
As it was previously stated here, there is no way to do this with pure CSS.
If you can use JavaScript, you can target the item and add it the attribute target="_blank".
document.getElementById("element").setAttribute("target", "_blank");
document.getElementById("element").setAttribute("target", "_blank");
You can add this piece of js in your footer.php file.
Another method is to add a js file and include it using wp_enqueue_script function in your function.php file.
Here is my problem, I have an iframe of a wordpress page (with stripped header/fooder/sidebar) with lots of links and I want when the user clicks on the links for them to open on the parent window and not the iframe.
I know I can use:
<a target="_parent" href="http://url.org">link</a>
on the links, but since the links point to wordpress posts and the list of posts is updated dynamically, this isn't a very good option. I can't edit them one-by-one to add the target. Plus, it might interfere with the rest of the site's links.
Another option is to use
<base target="_parent">
on the iframe header but I don't know how to do that.
Suppose I have this code to add the iframe:
<iframe class="bg-dark3" style="border: none;" src="https://www.google.com" scrolling="no"></iframe>
Where and how can I add the <base target="_parent"> line?
You can add this to your Wordpress site. It's Jquery to open the links in the parent. So please make sure Jquery library is loaded.
$('a').click(function(){
//Get url from anchor
var link = $(this).attr('href');
//Open url in parent
window.parent.parent.window.location = link;
});
This will automatically open the links in the parent, you wouldn't need to add target=_parent to each link manually.
I 've created a website www.milan-kresojevic.com.Everything is fine and now installed wordpress blog plugin to my server and started building a blog to.You can notice that when you come to the main menu on this website,and right click on the "Blog" button,you can open it in new window so the link seems to be working.BUT...
When you left-click on in as every normal link- it doesn't work :/
This is a bit confusing,and I've tried changing it in a zillion ways,and it is still the same.
Right-click "open in a new window" works,and left-click doesnt :(
Does anybody have an idea how should I change it?
Thanks in advance...
:)
SOLVED!Like this:
Ok,I ma going to show you what I did,so that this post might actually help someone else :)
My HTML nav code was this:
http://imageshack.com/a/img850/4371/40g8.png
So I listened to the nice man above me :)
And did this with the github source:
add the imageshack url in front of this I can not post 2 links as a new user :/a/img850/6605/uxs5.png
Found this on the github and my regular jquery.nav.js with this right here :https://github.com/davist11/jQuery-One-Page-Nav,
and added some JS code at the bottom of my page :
$(document).ready(function() {
$('#nav').onePageNav({
filter: ':not(.external)',
});
});
And that was it :) All works now,and I hope this is detailed enough to help someone else :)
your problem is the jquery.nav plugin. which expects only links linking to anchors on the page. try adding the class 'external' to the specific items and it should open the link as expected.
As soon as you create a menu item for a page there is a link that it automatically populated with it. How do i stop wordpress from making these links? I'm capable of making them myself and don't always want them to link to thier specific page.
I figured it out using and dropping it in my header.php
<script type="text/javascript">
jQuery(function($) {
$("li.menu-item-627,li.menu-item-14,li.menu-item-20,li.menu-item-28").children("a").attr('href', "javascript:void(0)");
});
</script>
You have to use firebug or chrome "inspect element" to find out what your menu items are and then just replace the numbers in the code accordingly.
also if you don't want them to show up at all add the following code
<script type="text/javascript">jQuery(function($) { $("li.menu-item-627").contents().hide();});</script>
those two together will hide the disabled menu link
you can then add your own links in the "navigation label" of the page menu field!
good luck and let me know if you have any questions, i will do my best to help!