Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #233031

    Hello,

    I saw a different post with a similar inquiry, tried implementing the code, and it didn’t work. So, I figured I’d ask the question.

    I’m using two fullwidth masonry portfolio grids, and for one of them I’d like the portfolio item links to open in new windows. I tried changing out the code per this forum response: https://kriesi.at/support/topic/portfolio-custom-link-to-open-in-a-new-page/#post-223280; and it didn’t work.

    Thank you for your help.

    #234652

    Hey GavinAnstey!

    Open up wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/masonry_entries.php and replace:

    
    if($custom_link) $this->loop[$key]['url'] = $custom_link;
    

    with

    
    if($custom_link) $this->loop[$key]['url'] = $custom_link;
    if($custom_link) $blank = "target='_blank'";
    

    and

    
    $this->loop[$key]['html_tags'] = array('a href="'.$this->loop[$key]['url'].'"','a');
    

    with

    
    if(empty($blank)) $blank = '';
    $this->loop[$key]['html_tags'] = array('a '.$blank.' href="'.$this->loop[$key]['url'].'"','a');
    

    Regards,
    Peter

    #391623

    Hi Dude,
    I follow your recomandations but the links still open on the same window.
    Thanks

    #391624

    Hi!

    Can you please post the link to your website and elaborate on the changes you would like to make?

    Regards,
    Yigit

    #391625
    This reply has been marked as private.
    #391635

    Hi!

    Please add following code to Functions.php file in Appearance > Editor

    function add_custom_target(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('#av-masonry-1 a').attr('target','_blank');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_target');

    Regards,
    Yigit

    #391673

    Hi Yigit,
    it seems to work perfectly with your function
    And I have restored config-templatebuilder/avia-shortcodes/masonry_entries.php
    I did well?
    It still works fine.
    Thanks

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Portfolio Custom URL/Link Setting Open in New Window’ is closed to new replies.