Tagged: portfolio entry
-
AuthorPosts
-
January 29, 2020 at 12:21 pm #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,
ElaJanuary 29, 2020 at 9:59 pm #1179604Hey 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,
VictoriaJanuary 30, 2020 at 3:47 pm #1179932Hi 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, ElaJanuary 31, 2020 at 11:39 am #1180233Hi 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,
VictoriaJanuary 31, 2020 at 7:52 pm #1180381Hi 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, ElaFebruary 5, 2020 at 10:48 am #1181686Hi 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, ElaFebruary 5, 2020 at 12:15 pm #1181725Hi,
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,
IsmaelFebruary 5, 2020 at 3:58 pm #1181799Hi 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,
ElaFebruary 9, 2020 at 3:58 am #1182683Hi,
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,
IsmaelFebruary 9, 2020 at 2:04 pm #1182719Hi Ismael,
Thank you for your reply. Attached you´ll find a login.
Thank you & best reagrds, Ela!February 10, 2020 at 7:52 am #1182956Hi,
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,
IsmaelFebruary 10, 2020 at 9:17 am #1182964Hi Ismael,
Fantastic!!!! :) Thank you very much!!!!
Best regards,
Ela- This reply was modified 4 years, 10 months ago by bts-de.
February 10, 2020 at 1:51 pm #1183045 -
AuthorPosts
- You must be logged in to reply to this topic.