2014-10-09 110 views
0

在Wordpress v4.0文件/wp-includes/js/wplink.js第200行中,我想通過WordPress插件排隊自己的js,並重新定義函數htmlUpdate以修改它的功能。什麼是正確的方式來做到這一點? PS:我很歡迎enqueing腳本等。只需要幫助我如何用我自己的插件覆蓋功能。WordPress的Redeclare jquery插件功能

htmlUpdate: function() { 
//... blah blah 
} 

回答

0

你可以嘗試這樣的:

add_action('admin_footer-post-new.php', 'my_custom_method', 9999); 
add_action('admin_footer-post.php',  'my_custom_method', 9999); 

function my_custom_method() { 
    ?> 
    <script type="text/javascript"> 
     (function($) { 

      if (typeof wpLink == 'undefined') 
       return; 

      // Override the function 
      wpLink.htmlUpdate= function() { 
       //... blah blah 
      }; 
     })(jQuery); 
    </script> 
    <?php 
} 

希望這是你在找什麼..