-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from landwire/bugfix/check_for_timber
Bugfix/check for timber
- Loading branch information
Showing
1 changed file
with
40 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
<?php | ||
/* | ||
Plugin Name: Timber Debug Bar | ||
Plugin URI: https://github.com/upstatement/debug-bar-timber/ | ||
Description: Adds Timber render to the debug bar. Requires the debug bar plugin. | ||
Author: Jared Nova + Upstatement | ||
Version: 1.0.8 | ||
Author URI: https://upstatement.com/ | ||
*/ | ||
|
||
add_filter('debug_bar_panels', static function($panels) { | ||
require_once('class-debug-bar-timber.php'); | ||
$panels[] = new Debug_Bar_Timber(); | ||
return $panels; | ||
}); | ||
|
||
add_action('init', static function() { | ||
if ( !class_exists('Debug_Bar') ) { | ||
$class = 'error'; | ||
|
||
$url = admin_url('plugin-install.php?tab=plugin-information&plugin=debug-bar&TB_iframe=true&width=772&height=300'); | ||
|
||
$text = "In order to use the Timber Debug Bar, you need to install and activate the <a href='$url' class='thickbox'>WordPress Debug Bar</a> Plugin"; | ||
|
||
add_action( 'admin_notices', static function() use ( $text, $class ) { | ||
echo '<div class="'.$class.'"><p>'.$text.'</p></div>'; | ||
}, 1 ); | ||
} | ||
}, 11); | ||
|
||
function tdb_enqueue_styles() { | ||
wp_enqueue_style( 'dbt', plugins_url( "timber-debug-bar.css", __FILE__ ), [], '20200710' ); | ||
} | ||
add_action( 'wp_enqueue_scripts', 'tdb_enqueue_styles', 99 ); | ||
<?php | ||
/* | ||
Plugin Name: Timber Debug Bar | ||
Plugin URI: https://github.com/upstatement/debug-bar-timber/ | ||
Description: Adds Timber render to the debug bar. Requires the debug bar plugin. | ||
Author: Jared Nova + Upstatement | ||
Version: 1.0.5 | ||
Author URI: https://upstatement.com/ | ||
*/ | ||
|
||
// bail early if Timber class does not exist | ||
// useful when you switch themes to non timber based themes (ie. twentytwentyone) for debugging etc. | ||
if ( !class_exists('Timber') ) { | ||
return; | ||
} | ||
|
||
add_filter('debug_bar_panels', static function($panels) { | ||
require_once('class-debug-bar-timber.php'); | ||
$panels[] = new Debug_Bar_Timber(); | ||
return $panels; | ||
}); | ||
|
||
add_action('init', static function() { | ||
if ( !class_exists('Debug_Bar') ) { | ||
$class = 'error'; | ||
|
||
$url = admin_url('plugin-install.php?tab=plugin-information&plugin=debug-bar&TB_iframe=true&width=772&height=300'); | ||
|
||
$text = "In order to use the Timber Debug Bar, you need to install and activate the <a href='$url' class='thickbox'>WordPress Debug Bar</a> Plugin"; | ||
|
||
add_action( 'admin_notices', static function() use ( $text, $class ) { | ||
echo '<div class="'.$class.'"><p>'.$text.'</p></div>'; | ||
}, 1 ); | ||
} | ||
}); | ||
|
||
function tdb_enqueue_styles() { | ||
wp_enqueue_style( 'dbt', plugins_url( "timber-debug-bar.css", __FILE__ ), [], '20200710' ); | ||
} | ||
add_action( 'wp_enqueue_scripts', 'tdb_enqueue_styles', 99 ); |