Tagged: 

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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

    #618727

    Hi 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!
    Yigit

    #618815

    Here 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.

    Screenshot

    *disregard the web design at this stage haha, it’s not compelte*

    #621035

    Hey!

    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!
    Ismael

    #621799

    Hi 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

    #621801

    Hello 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

    #622914

    Hi!

    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,
    Ismael

    #623408

    Here 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.

    #625455

    Hi,

    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,
    Ismael

    #626111

    Hello :)

    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 :S

    #626821

    Hi,

    Please provide us ftp login details and we will take it from there and help you resolve this issue.

    Best regards,
    Vinnie

    #626844

    I 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

    #627594

    Hi,

    Ok, thanks for letting us know.

    Best regards,
    Rikard

    #652783

    I have restructured how the blog works so you can close this thread :)

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Posts set to "Link" to open in new tab’ is closed to new replies.