Advertisement
fauzanjeg

Make Post Link Open New Tab

Nov 17th, 2021
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. /* Add Script to Footer */
  2. function make_post_link_to_open_new_tab_in_archive() {
  3.     if ( is_archive() ) :
  4.     ?>
  5.     <script>
  6.         /* Make Post Link Open New Tab */
  7.         (function ($) {
  8.             $(window).ready(function () {
  9.                 $('.jeg_post a, .jeg_posts a').each(function () {
  10.                     $(this).attr('target', '_blank');
  11.                 })
  12.             })
  13.         })(jQuery);
  14.     </script>
  15.     <?php
  16.     endif;
  17. }
  18. add_action( 'wp_footer', 'make_post_link_to_open_new_tab_in_archive' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement