Skip to content

Instantly share code, notes, and snippets.

@lkraav
Created October 28, 2013 19:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lkraav/7203211 to your computer and use it in GitHub Desktop.
Save lkraav/7203211 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Toolbar Theme Switcher - LESS CSS Integration
Plugin URI: https://github.com/sanchothefat/wp-less/issues/43
Description: Fix cache refresh when switching themes
Author: Leho Kraav
Author URI: http://leho.kraav.com
Version: 1.0
License: MIT
*/
function tts_less_init() {
if ( ! class_exists( "Toolbar_Theme_Switcher" ) ) return;
add_filter( "wp_less_cache_path", "tts_less_cache_path" );
add_filter( "wp_less_cache_url", "tts_less_cache_path" );
}
add_action( "plugins_loaded", "tts_less_init" );
function tts_less_cache_path( $path ) {
return sprintf( "%s-%s", $path, basename( get_stylesheet_directory() ) );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment