Skip to content

Instantly share code, notes, and snippets.

@neojp
Created January 20, 2014 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neojp/8527802 to your computer and use it in GitHub Desktop.
Save neojp/8527802 to your computer and use it in GitHub Desktop.
WordPress - Debug Bar Panel class
<?php
Class CustomDebugBarPanel extends Debug_Bar_Panel {
public function init() {
$this->title(__('Custom Debug Bar Panel', 'debug-bar'));
add_action('wp_print_styles', array( $this, 'print_styles'));
add_action('admin_print_styles', array( $this, 'print_styles'));
}
public function prerender() {
$this->set_visible(true);
}
public function print_styles() {
wp_enqueue_style('custom-debug-bar-panel', plugins_url('css/custom-debug-bar-panel.css', __FILE__));
}
public function render() {
?>
<div class="debug-bar-cron">
<p>Content goes here</p>
</div>
<?php
}
}
<?php
/* Plugin name: Custom Debug Bar Panel */
add_filter('debug_bar_panels', function($panels) {
include_once('custom-debug-bar-panel-class.php');
$panels[] = new CustomDebugBarPanel();
return $panels;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment