Advertisement
fauzanjeg

JKIT || Add CTA Buttons to Gallery widget

Nov 16th, 2022
1,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. /** Add CTA Button to JKIT Gallery widget  */
  2. function add_cta_button_to_jkit_gallery() {
  3.     ?>
  4.     <script id="add-cta-button-to-jkit-gallery">
  5.         (function ($) {
  6.             var $widget = $('.jeg-elementor-kit.jkit-gallery'),
  7.                 $item = $widget.find('.gallery-item-wrap');
  8.  
  9.             $item.each(function (index) {
  10.                 var buttonLink = $(this).find('.gallery-link[data-elementor-open-lightbox="no"]').attr('href'),
  11.                     buttonTemplate = `<div class="button-wrapper"><a href="${buttonLink}">Get Sample</a></div>`;
  12.  
  13.                 $(this).find('.item-caption-over').append(buttonTemplate);
  14.             })
  15.         })(jQuery)
  16.     </script>
  17.     <?php
  18. }
  19. add_action( 'wp_footer', 'add_cta_button_to_jkit_gallery' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement