forked from thom4parisot/wp-less
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-for-theme.php
50 lines (47 loc) · 1.9 KB
/
bootstrap-for-theme.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/*
* This file tends to be included in any development.
* In a sentence, in every case where you don't want to use WP-LESS as a standalone.
*
* Once included, it's up to you to use the available toolkit for your needs.
*
* = How to use? =
*
* 1. In your theme, include the `wp-less` anywhere you want. (eg: `wp-content/themes/yourtheme/lib/wp-less`)
* 2. Include the required files in your functions.php file. (eg: `require dirname(__FILE__).'/lib/wp-less/bootstreap-theme.php`)
* 3. The `$WPLessPlugin` is available for your
*
* In case you need to access the $WPLessPlugin variable outside the include scope, simply do that:
* `$WPLessPlugin = WPLessPlugin::getInstance();`
*
* And to apply automatic building on page display:
* `add_action('wp_print_styles', array($WPLessPlugin, 'processStylesheets'));`
* Or apply all hooks with:
* `$WPLessPlugin->dispatch();`
*
* You can rebuild all stylesheets at any time with:
* `$WPLessPlugin->processStylesheets();`
*
* Or a specific stylesheet:
* `wp_enqueue_style('my_css', 'path/to/my/style.css');`
* `$WPLessPlugin->processStylesheet('my_css');`
*
* = Filters and hooks aren't enough =
*
* Build your own flavour and manage it the way you want. Simply extends WPLessPlugin and/or WPLessConfiguration.
* Dig in the code to see what to configure. I tried to make things customizable without extending classes!
*/
/*
* This will be effective only if the plugin is not activated.
* You can then redistribute your theme with this loader fearlessly.
*/
if (!class_exists('WPLessPlugin'))
{
require dirname(__FILE__).'/lib/Plugin.class.php';
$WPLessPlugin = WPPluginToolkitPlugin::create('WPLess', __FILE__, 'WPLessPlugin');
//READY and WORKING
//add_action('after_setup_theme', array($WPLessPlugin, 'install'));
// NOT WORKING
//@see http://core.trac.wordpress.org/ticket/14955
//add_action('uninstall_theme', array($WPLessPlugin, 'uninstall'));
}