Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('customize_controls_print_footer_scripts', function(){?>
- <script type="text/javascript">
- ( function ( wp, $ ) {
- console.log($("#save"))
- var btn = $("<button style='margin-right: 5px' class='button button-primary'>Reload CSS</button>").click(function(e){
- e.preventDefault(true);
- wp.customize.previewer.preview.iframe.get(0).contentWindow.reloadStylesheets();
- });
- $("#save").after(btn);
- })( window.wp, jQuery );
- </script>
- <?php }, 9999);
- if(is_customize_preview())
- {
- add_action('wp_footer', function(){ ?>
- <script type="text/javascript">
- function reloadStylesheets() {
- var queryString = '?reload=' + new Date().getTime();
- jQuery('link[rel="stylesheet"]').each(function () {
- this.href = this.href.replace(/\?.*|$/, queryString);
- });
- }
- </script>
- <?php
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement