Tagged: link format
-
AuthorPosts
-
April 20, 2016 at 6:42 am #618006
I am trying to find a way to get my posts that I have set to “link” in the post options to open in a new tab.
I have my blog set up as a grid so I would need both the feature image and title to link to “target_blank”I have tried a good 3 or 4 solutions found on other enfold support threads but none of them are working for me.
I am on the latest version of enfold.Any help would be much appreciated.
Briana
April 20, 2016 at 9:41 pm #618727Hi Bcunningham!
Can you please post the link to your blog and point out the links that you would like to open in new window?
Cheers!
YigitApril 21, 2016 at 2:43 am #618815Here is my client’s blog set up in Grid Style – Each item is set to “Link” in the post format options.
I need both the photo and the title to link to a new tab as they are links to another website’s article and I don’t want the visitor to lose where they are on my client’s site.*disregard the web design at this stage haha, it’s not compelte*
April 25, 2016 at 7:27 am #621035Hey!
Thank you for the info. Please add this in the functions.php file:
// new script add_action('wp_footer', 'ava_new_custom_script'); function ava_new_custom_script(){ ?> <script type="text/javascript"> (function($) { function e() { $('.slide-entry').each(function() { $(this).find('.avia-content-slider .slide-entry-title a').attr('target', '_blank'); $(this).find('.slide-image').attr('target', '_blank'); }); } e(); })(jQuery); </script> <?php }
Cheers!
IsmaelApril 26, 2016 at 12:51 am #621799Hi Ismael,
I have added the code to the functions.php in my child theme and it’s given me a blank screen. I had to go through cpanel and remove it :S
Did I do something wrong on my end maybe?Briana
April 26, 2016 at 12:55 am #621801Hello again,
I took out “// new script” from the code you gave and now the blog image links out to a new tab which is excellent but the title link does not :)
Almost there, just need to have the blog title link out externally as well.
Briana
April 27, 2016 at 10:54 am #622914Hi!
You removed a comment line. It’s not supposed to affect the script in any way. Please post the url to the actual page.
Best regards,
IsmaelApril 28, 2016 at 12:20 am #623408Here is the blog page that now has working images that link out to a new tab but the titles do not. I would prefer them both to link out to a new tab if set to “Post” in the post options but if necessary we could disable the title link and only have the images link.
May 2, 2016 at 5:55 am #625455Hi,
My bad. There’s a little syntax error to the code. Please replace it with the following:
// new script add_action('wp_footer', 'ava_new_custom_script'); function ava_new_custom_script(){ ?> <script type="text/javascript"> (function($) { function e() { $('.slide-entry').each(function() { $(this).find('.slide-entry-title a').attr('target', '_blank'); $(this).find('.slide-image').attr('target', '_blank'); }); } e(); })(jQuery); </script> <?php
Best regards,
IsmaelMay 3, 2016 at 2:59 am #626111Hello :)
I put in the new code and my entire functionc PHP looks like this:
<?php /* * Add your own functions here. You can also copy some of the theme functions into this file. * WordPress will use those functions instead of the original functions then. */ // new script add_action('wp_footer', 'ava_new_custom_script'); function ava_new_custom_script(){ ?> <script type="text/javascript"> (function($) { function e() { $('.slide-entry').each(function() { $(this).find('.slide-entry-title a').attr('target', '_blank'); $(this).find('.slide-image').attr('target', '_blank'); }); } e(); })(jQuery); </script> <?php add_theme_support('avia_template_builder_custom_css');
It broke the site when I saved and now it’s just a blank screen.
Help please :SMay 4, 2016 at 12:11 am #626821Hi,
Please provide us ftp login details and we will take it from there and help you resolve this issue.
Best regards,
VinnieMay 4, 2016 at 1:59 am #626844I am not allowed to unfortunately. This is our business’ testing server and we have multiple sites on it and our cpanel says we can’t create anymore ftp access accounts.
It’s really not a big deal and I can do a work around it since that code wasn’t working for me for some reason.
Thanks for your help though :D
May 5, 2016 at 5:15 am #627594June 24, 2016 at 1:26 am #652783I have restructured how the blog works so you can close this thread :)
-
AuthorPosts
- The topic ‘Posts set to "Link" to open in new tab’ is closed to new replies.