-
AuthorPosts
-
October 11, 2016 at 12:11 pm #697756
Hi,
I’m using the grid format for my blog archive page (if it matters, it’s for a custom post type called ‘adoption’). I used the grid format because it allows a larger number to be displayed in a smaller space, which is great. Users of the site will need to be able to search these posts – I will use a search and filter plugin for this – although they can also scroll randomly. I’m using the same format for both post archives and taxonomy pages.However, when the posts are displayed, they always open in the same window, which blows any sort of search out of the water (they’d have to reset the search after every post they open). All I want is for the post links/featured image links to open in a new window. I’ve looked through options and see no reference to this at all. How do I do it? Sorry if I’m missing something obvious!
Thanks
October 12, 2016 at 2:07 pm #698272Hey brian7454,
Would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :)
Please post us your login credentials as well (in the “private data” field), so we can take a look at your backend.
Login credentials include:
- The URL to the login screen.
- A valid username (with full administration capabilities).
- As well as a password for that username.
- permission to deactivate plugins if necessary.
Best regards,
AndyOctober 12, 2016 at 6:19 pm #698451Just to be clear, I’m asking how to make links on a blog page – grid layout – open in a new window? Nothing else? As I said above: “All I want is for the post links/featured image links to open in a new window.”.
I’m confused as to why that would require admin access, as links opening in same window appears to be default Enfold behaviour insofar as that’s how your own demo functions, and there are no visible options which affect this. So it’s not a case of plugins interfering with anything. But anyway, I will add a temporary login below.
I’d prefer that you don’t turn off plugins without needing to, as I’m working on the site more or less all the time at present. In any case, if you turn off Formidable forms, only the submission forms will break, but if you turn off ‘adoption posts’ or ‘advanced custom fields’ nothing in relation to custom posts will work, and so there will be zero content on the blog pages. If you really need to turn things off, then please put them back on asap.
If extra code needs to be added to the archive and taxonomy template pages then please tell me because I’ll add it myself – there are currently 4 pages in use, but there will be more added in future, so I need to know how to do this myself.
Thanks!
October 12, 2016 at 8:02 pm #698507Hi!
Please check here, on how links have to open in new window
http://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window-using-javascriptLet us know if we can do anything else for you
Best regards,
BasilisOctober 13, 2016 at 7:44 am #698590That’s absolutely no help at all.
How do I get links from a blog page, grid layout, to open in a new window? There are no options to alter and there is nowhere I can add any code unless perhaps in the archive template. This is a basic feature, available more or less everythwre on the internet, but it is not apparent how to do this on your blog pages.
Please explain how to do it.
October 13, 2016 at 3:09 pm #698779Hi,
We would love to help you with this issue but you are not using one of our themes. Please contact the theme author for the support they know their theme better.
Best regards,
VinayOctober 13, 2016 at 3:24 pm #698789I’m glad to hear you’d love to help me with this question.
It would appear that when you visited I was trying a different theme, yes. People do that. It’s a way of testing things. If you’d looked, you’d have noticed Enfold is there too, but deactivated while I try to find answers to something. I can’t just sit here not doing anything, waiting for an answer. The original question was posted two days ago. I’ll now activate Enfold again and wait for an answer. You’ll forgive me but I don’t understand why someone needs to log onto my site in order to tell me how to get links from a blog page to single post pages open in a new window, but maybe I’m missing something.
Seriously, I cannot believe that it takes two days for someone to answer a question about how to open links in a new window.
- This reply was modified 8 years, 2 months ago by brian7454.
October 13, 2016 at 10:19 pm #698910Hi!
Thank you for re-activating enfold. To address your concerns yes you are free to try different themes :) and by now you may have noticed that the feature you requested is not a standard feature in most of the themes.
Having said that every site is setup in a different way which results in different output of the code. Since this is a custom code we are providing specially for you we want to make sure the code we provide will work with the settings you have chosen which will also eliminate the delay caused by back and forth.
We have added the below code in functions.php file please review your site and let us know if you have any questions.
// open in new window function newWindow(){ ?> <script> jQuery(document).ready(function() { jQuery('.adoptarchive .slide-image').each(function () { jQuery(this).attr('target','_blank'); }); jQuery('.adoptarchive h3.entry-title a').each(function () { jQuery(this).attr('target','_blank'); }); }); </script> <?php } add_action('wp_footer', 'newWindow');
Best regards,
VinayOctober 14, 2016 at 12:26 am #698936That’s great, I’ll have a look at it tomorrow when I get up.
Um, as regards other themes, I have somewhere around 40 sites using wordpress, which I believe use 12 themes (I may be wrong). I have to say that this is the first time I’ve found one where I’ve needed to ask for help to get blog links to open in a new frame. I’ll admit that I have only needed to do it with the blog page a few times, maybe 6, but it has never been a problem. I need a similar setup to that I used on britishcatteries.co.uk, because if you set up a search feature to filter posts, users won’t want to redo the search every time they click on a link. That site has around 500 catteries, plus maybe twice as many vets, and the average user who makes enquiries contacts 4 catteries. So redoing a search after each contact would be a pain in the butt. It may not be the kind of thing people use often, but when they do it’s usually for a good reason. I came across several enfold users searching for ways to open links from portfolios and also blogs in a new window, so perhaps a code snippet – a revisable example – would be a good addition to the snippets section?
To be honest, I’d have been able to do it myself except there’s no reference anywhere as to how the blog output is generated. The archive and loop templates seem to have nothing that can be modified to allow manual creation of links, and I can’t see where the output comes from. With sites like this I generally use avada, which is a doddle to modify in that respect. I first tried using enfold a year ago, but eventually gave up. I’ll say that the current version (of enfold) is much better, but it’s a shame it’s so difficult to modify and there aren’t any guidelines for people who want to modify stuf (not custom coding, but indications as to which files do what). Still, I’ll keep going and hope I can get the right results this time.
Anyway, thanks.
- This reply was modified 8 years, 2 months ago by brian7454.
October 14, 2016 at 7:22 am #698990Hey!
Thank you for the inputs we will add this to our to do list and may be come up with the modification guidelines I think it’s a good idea and it will help others as well :)
Sure, please review the site and let us know if you need any further mods. We are happy to help!
Cheers!
VinayOctober 17, 2016 at 1:01 pm #699947Hi,
Please enable the custom css class field: http://kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/ and then edit your blog elements that you would like to open in new tab and give them a custom CSS class (“your-custom-class” in the example below) and then add following code to Functions.php file in Appearance > Editor
function avia_custom_target(){ ?> <script> jQuery(window).load(function(){ jQuery('.your-custom-class a').attr('target','_blank'); }); </script> <?php } add_action('wp_footer', 'avia_custom_target');
Best regards,
YigitOctober 19, 2016 at 10:19 am #701096I’ll have a look at that. Thanks
October 19, 2016 at 1:51 pm #701292Hi,
Please do so and let us know if you need further assistance :)
Best regards,
YigitNovember 1, 2016 at 6:20 pm #706820Vinay / Yigit,
The fix which your guys applied to my custom post archive (making them open in a new frame) works a treat….. except….
I added a search and filter bar (search and filter pro) on the pages. If I don’t use the filter bar, the links still open correctly, but as soon as I filter the posts, they refuse to open in a new window. I looked at the css and there’s no reason I can see why it should not work.
Plainly, it is connected to the filter bar – which is essential – and I have asked the author if he knows what the conflict might be, but I wondered if you might have any ideas?
I’ve added a login below, in case you want to take a look. Thanks
November 1, 2016 at 7:40 pm #706837I found the solution – it was an issue with ajax.
ThanksNovember 2, 2016 at 1:38 am #706942Hi,
Glad it’s fixed :)
Best regards,
NikkoJuly 19, 2018 at 12:32 pm #987356Sorry that i quote that older post but i need help. Can i include in this php code 2 section ids? The target blank works for me, but i need another section id that opens in a _self window. Is that possible?
July 20, 2018 at 10:31 pm #988048Hi,
The easiest way is to add 2 times jQuery(‘.your-custom-class a’).attr(‘target’,’_blank’);
and change the class with what you need :)Best regards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.