Advertisement
fauzanjeg

JKIT || Redirect After Click Post Wrapper in Post Block Widgets

Mar 4th, 2024
776
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. /**
  2.  * Redirect After Click Post Wrapper in Post Block Widgets
  3.  */
  4. function redirect_after_click_post_wrapper() {
  5.     ?>
  6.     <script type="text/javascript">
  7.         (function ($) {
  8.             $(document).on('ready', () => {
  9.                 const post = $('.jkit-postblock .jkit-posts .jkit-post');
  10.  
  11.                 post.on({
  12.                     click: (e) => {
  13.                         const url = $(e.target).closest('.jkit-post').find('.jkit-meta-readmore a.jkit-readmore').attr('href');
  14.  
  15.                         window.location.href = url;
  16.                     }
  17.                 })
  18.             })
  19.         })(jQuery)
  20.     </script>
  21.     <?php
  22. }
  23. add_action( 'wp_footer', 'redirect_after_click_post_wrapper' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement