Tagged: yigit
-
AuthorPosts
-
March 29, 2016 at 6:01 pm #604711
I have set this site, and in several pages I have use a portfolio with a image that have a link, and I would like that this url will open in a new window, but there is not the posibility in the portfolio. I have tried adding a code target=_blank, but I do not if do wrong; but it does not work.
The site is this one:
http://www.distritohm.com/Thanks.
March 29, 2016 at 6:21 pm #604725Hey hector1069!
Please turn on custom CSS field for ALB elements – kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/ and then edit your element and give it a custom CSS class and then add following code to Functions.php file in Appearance > Editor
function my_custom_target(){ ?> <script> jQuery(window).load(function(){ jQuery('.your-custom-class a').attr('target','_blank'); }); </script> <?php } add_action('wp_footer', 'my_custom_target');
Regards,
YigitMarch 29, 2016 at 6:26 pm #604729Does your code look like this?
<a href="http://www.example.com" target="_blank">Click Me</a>
March 29, 2016 at 6:56 pm #604749Yes, my code was like that, I wrote it on portfolio link gap, but it did not work.
Now, I have done what you told me but, it does not work… and in the template appear a weird code (see image).
I give you my logincredentials if you want to check it.
March 30, 2016 at 7:49 pm #605407Hi!
your login link does not work. Can you check please?
Best regards,
AndyMarch 30, 2016 at 9:24 pm #605470I send you the link again.
Thanks
April 1, 2016 at 2:12 am #606427Hey!
I changed the code in Functions.php file to following one
function my_custom_target(){ ?> <script> jQuery(window).load(function(){ jQuery('.custom-element a').attr('target','_blank'); }); </script> <?php } add_action('wp_footer', 'my_custom_target');
and added custom class to your element on your “workspaces” page – http://i.imgur.com/hkSdIQB.png
Please review your website now and apply the same class to your other element where you would like to open in new tabCheers!
YigitApril 1, 2016 at 11:50 am #606603Hi Yigit,
It is almost perfect. A weird thing happens when you make click on the image the first time do not open in a new window, but the second do it perfectly.
What can it happen?
Cheers!
Almudena.April 1, 2016 at 12:36 pm #606630April 1, 2016 at 1:40 pm #606650Hi Yigit!!
Ok. Thanks a lot and have a good day.
AlmudenaApril 1, 2016 at 2:01 pm #606657 -
AuthorPosts
- The topic ‘Link in a new page’ is closed to new replies.