Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1114041

    Hello,

    I’m using the masonry element to display blog posts and I was wondering if there was a way to make these posts open up in a new tab. Thanks!

    #1114546

    Hey bobfurgo,
    Sorry for the late reply, we could do this with some javascript but we will need to see the page to examine the sectors.
    Right now the page requires a login to view.

    Best regards,
    Mike

    #1114915

    Hi Mike, thanks for your reply. Please see private area for login details. Thanks!

    #1115516

    Hello, just following up on this. Thanks!

    #1115551

    Hi bobfurgo,

    Best regards,
    Victoria

    #1115578

    Sorry about that! See private area

    #1115881

    Hi bobfurgo,

    Here is the code you can put in your funtions.php

    
    function av_add_attribute() {
    ?>
    	<script type="text/javascript">
    		(function($) {
    			$(window).load(function() {
    				$('.home #av-masonry-1 .av-masonry-entry.isotope-item').attr('target', '_blank');
    			});
    		})(jQuery);
    	</script>
    <?php
    }
    add_action('wp_footer', 'av_add_attribute');
    

    If you need further assistance please let us know.

    Best regards,
    Victoria

    • This reply was modified 5 years, 5 months ago by Victoria.
    #1121951

    Hi Victoria!

    I’ve put that code into the child theme’s functions.php but the blog post links still aren’t opening in a new tab. Could you please help with this? Thanks so much!

    #1122437

    Hi,
    Sorry for the late reply, I took a look at your site and found that your jQuery was giving this error:

    jQuery is not defined

    Typically this is due to one of your plugins is conflicting with other plugins, or
    JavaScript runs before the page is fully loaded in turn before the jQuery is fully loaded, or
    CDN-hosted jQuery might be blocked or down.
    I ended up correcting the error by adding this to your functions.php

    function av_add_jquery() {
    ?>
    		<script src="https://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>
    <?php
    }
    add_action('wp_head', 'av_add_jquery');

    Now your posts are opening in a new tab, please clear your browser cache and check.

    Best regards,
    Mike

    #1127286

    Hi Mike! Sorry for the delayed reply and thanks so much for your efforts and prompt responses. However I checked in an incognito and cleared my cookies, looks like the blog posts are still opening in the same tab unfortunately.

    #1127493

    Hi,
    Sorry, I tested again in incognito with a clear cache, but the masonry is opening in new tabs for me. Please see the video in Private Content area.

    Best regards,
    Mike

    #1127760

    You’re awesome Mike! Thank you!

    #1127837

    Hi,
    Glad we were able to help, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Blog posts displayed in Masonry element open up in new tab?’ is closed to new replies.