Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. // Check if function doest not exists.
  2. if ( ! function_exists( 'rtmedia_wp_footer_add_js_callback' ) ) {
  3. function rtmedia_wp_footer_add_js_callback() {
  4. ?>
  5. <script type="text/javascript">
  6. jQuery(document).ready(function($) {
  7. // Event will fire when someone click on edit button of media.
  8. jQuery( 'body' ).on( 'click', '.rtmedia-gallery-item-actions a:first',function(){
  9. var target = jQuery( this ).attr( 'target' );
  10.  
  11. // Checked for the target attribute if it exists or not and is also set to blank.
  12. if ( target != 'undefined' && target == '_blank' ) {
  13.  
  14. // Replace the blank target attribute to self target attribute.
  15. jQuery( this ).attr( 'target', '_self' );
  16. }
  17. });
  18. });
  19. </script>
  20. <?php
  21. }
  22. }
  23. add_action( 'wp_footer', 'rtmedia_wp_footer_add_js_callback', 10, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement