-
AuthorPosts
-
October 4, 2024 at 8:58 am #1468408
Also, on the page (see Private Content) how can we make the whole image be clickable instead of just the text in the portfolio grid?
October 5, 2024 at 10:33 am #1468461because i do not see private content – i guess your page is like this:
https://kriesi.at/themes/enfold-2017/blog/blog-default/ – and you like to have the link for the whole (Image, heading, excerpt and read-more)
if you like to have it more specific – use custom classes or page-id’sthis snippet transfers the first link that could be found in the articel to the slide-entry:
function transfer_first_link_as_link_to_article(){ ?> <script type="text/javascript"> window.addEventListener("DOMContentLoaded", function () { (function($) { $('.slide-entry').each( function() { var LinkSection = $(this).find('a:first').attr('href'); var LinkTarget = $(this).find('a:first').attr('target'); if (typeof LinkSection !== "undefined"){ $(this).on("click", function(){ if (LinkTarget === "_blank"){ window.open(LinkSection, '_blank'); } else { window.location.href = LinkSection; }; }); $(this).css('cursor','pointer'); }; }); })(jQuery); }); </script> <?php } add_action('wp_footer', 'transfer_first_link_as_link_to_article');
October 5, 2024 at 11:09 am #1468469Hi,
Thanks for helping out @guenni007 :-)
Did you try that out and did you have any luck with it @whdsolutions?
Best regards,
RikardOctober 7, 2024 at 10:45 am #1468551October 7, 2024 at 12:43 pm #1468564ok – nice to have the page link (on your other topic it is shown):
there are links on the images too – but they could not be clicked because there is a full overlay of the grid-content
so no need for a script here#top .grid-content { pointer-events: none; } /*** if you do not like to have that image white overlay:*****/ #top .grid-entry .image-overlay { display: none !important; }
__________________________
this will work too – but it is not needed herefunction transfer_first_link_as_link_to_article(){ ?> <script type="text/javascript"> window.addEventListener("DOMContentLoaded", function () { (function($) { $('.grid-content').each( function() { var LinkSection = $(this).find('.grid-entry-title a').attr('href'); var LinkTarget = $(this).find('.grid-entry-title a').attr('target'); if (typeof LinkSection !== "undefined"){ $(this).on("click", function(){ if (LinkTarget === "_blank"){ window.open(LinkSection, '_blank'); } else { window.location.href = LinkSection; }; }); $(this).css('cursor','pointer'); $(this).find('.image-overlay').css('display','none'); }; }); })(jQuery); }); </script> <?php } add_action('wp_footer', 'transfer_first_link_as_link_to_article');
October 7, 2024 at 4:39 pm #1468589PERFECTION!
Thank you! -
AuthorPosts
- The topic ‘Whole block clickable – Portfolio Grid’ is closed to new replies.