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

    Hello,

    I´d like to add an external link to a portfolio entry.
    I´ve found this in your documentation https://kriesi.at/documentation/enfold/portfolio-grid/ and it helped me. Thank you!
    My only problem is, that the link opens on the same page (_self) and not in a new tab (_blank).
    Can I change that somehow? We´re using Enfold 4.7.1.

    Thank you & best regards,
    Ela

    #1179604

    Hey bts-de,

    Please have a look at the following threads:
    https://kriesi.at/support/topic/open-a-portfolio-entry-on-new-tab/
    https://kriesi.at/support/topic/portfolio-open-not-in-the-new-tab/

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1179932

    Hi Victoria,

    Thank you for your help! The following works great – but then all portfolio entries open in a new window.
    I´d like to have a new window just for the portfolio entries, where the field “external link” is filled out.

    function add_custom_port_target(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('.grid-entry .inner-entry a').attr('target','_blank');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_port_target');

    Have you got a further tipp for me?
    Thank you very much! Kind regards, Ela

    #1180233

    Hi bts-de,

    Sure, please give me the link to the page with the issue, I’ll give you a more exact css selector to use in the JavaScript code.

    Best regards,
    Victoria

    #1180381

    Hi Victoria,

    that sounds great! I´ve integrated the link. There are for example 5 entries and it would be great, if two of them open in a new window. You´ll see which one …
    Thank you & kind regards, Ela

    #1181686

    Hi Victoria,
    just additional the information, that two entries have got an other domain as external link and therefore you´ll know which one .. :)
    Thank you & best regards, Ela

    #1181725

    Hi,

    We updated the script a bit so that it checks if the value of the href attribute contains the domain name. Please try it again.

    function ava_add_custom_port_target(){
    	?>
    	<script>
    	jQuery(window).load(function(){
    		jQuery('.grid-entry').each(function() {
    			var entry = jQuery(this).find('.inner-entry a');
    			var link = entry.attr('href');
    
    			if(link.indexOf(window.location.host) == -1) {
    				entry.attr('target','_blank');
    			}
    		})	
    	});
    	</script>
    	<?php
    	}
    add_action('wp_footer', 'ava_add_custom_port_target');
    

    Best regards,
    Ismael

    #1181799

    Hi Ismael,

    Thank you very much! Unfortunately it´s working similar to the snippet I´ve found. Every entry opens in a new tab. You can try it!
    Do you have a further tipp for me? Thank you very much!
    Best regards,
    Ela

    #1182683

    Hi,

    Sorry for the delay. Can we access the site or the dashboard? Please post the login details in the private field, and make sure that the Appearance > Editor panel is accessible.

    Best regards,
    Ismael

    #1182719

    Hi Ismael,
    Thank you for your reply. Attached you´ll find a login.
    Thank you & best reagrds, Ela!

    #1182956

    Hi,

    Thank you for the info.

    We adjusted the script in the functions.php file so that it only applies the target attribute to the items with an external domain. It is now working as expected.

    Best regards,
    Ismael

    #1182964

    Hi Ismael,

    Fantastic!!!! :) Thank you very much!!!!

    Best regards,
    Ela

    • This reply was modified 4 years, 9 months ago by bts-de.
    #1183045

    Hi Ela,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.