Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. add_action('customize_controls_print_footer_scripts', function(){?>
  2. <script type="text/javascript">
  3. ( function ( wp, $ ) {
  4. console.log($("#save"))
  5. var btn = $("<button style='margin-right: 5px' class='button button-primary'>Reload CSS</button>").click(function(e){
  6. e.preventDefault(true);
  7. wp.customize.previewer.preview.iframe.get(0).contentWindow.reloadStylesheets();
  8. });
  9. $("#save").after(btn);
  10.  
  11. })( window.wp, jQuery );
  12. </script>
  13. <?php }, 9999);
  14.  
  15. if(is_customize_preview())
  16. {
  17. add_action('wp_footer', function(){ ?>
  18. <script type="text/javascript">
  19. function reloadStylesheets() {
  20. var queryString = '?reload=' + new Date().getTime();
  21. jQuery('link[rel="stylesheet"]').each(function () {
  22. this.href = this.href.replace(/\?.*|$/, queryString);
  23. });
  24. }
  25. </script>
  26. <?php
  27. });
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement