mirror of
https://github.com/kremalicious/Badged.git
synced 2024-12-27 15:17:43 +01:00
fix for badges in admin bar on frontend
This commit is contained in:
parent
6f24c7ca59
commit
d63f10048a
@ -52,7 +52,7 @@ class Badged {
|
||||
protected $plugin_screen_hook_suffix = null;
|
||||
|
||||
/**
|
||||
* Initialize the plugin by loading admin scripts & styles and adding a
|
||||
* Initialize the plugin by loading scripts & styles and adding a
|
||||
* settings page and menu.
|
||||
*
|
||||
* @since 2.0.0
|
||||
@ -65,9 +65,14 @@ class Badged {
|
||||
// Activate plugin when new blog is added
|
||||
add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
|
||||
|
||||
// Load admin style sheet
|
||||
// Load admin style sheets
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
||||
|
||||
// Load admin bar style sheets
|
||||
if ( is_admin_bar_showing() ) {
|
||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_adminbar_styles' ) );
|
||||
}
|
||||
|
||||
// Add the options page and menu item.
|
||||
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
|
||||
|
||||
@ -231,7 +236,7 @@ class Badged {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
private static function single_activate() {
|
||||
// TODO: Define deactivation functionality here
|
||||
// TODO: Define activation functionality here
|
||||
}
|
||||
|
||||
/**
|
||||
@ -272,19 +277,45 @@ class Badged {
|
||||
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->id == $this->plugin_screen_hook_suffix ) {
|
||||
wp_enqueue_style( $this->plugin_slug .'-admin-styles', BADGED_URL . 'admin/assets/css/admin.css', array(), Badged::VERSION );
|
||||
wp_register_style( $this->plugin_slug .'-admin-styles', BADGED_URL . 'admin/assets/css/admin.css', array(), self::VERSION );
|
||||
wp_enqueue_style( $this->plugin_slug .'-admin-styles' );
|
||||
}
|
||||
|
||||
$options = get_option( 'badged_settings' );
|
||||
|
||||
// Default Style
|
||||
if ( 'ios7' == $options['style'] ) {
|
||||
wp_enqueue_style( $this->plugin_slug .'-badged-styles', BADGED_URL . 'admin/assets/css/badged.css', array(), Badged::VERSION );
|
||||
wp_register_style( $this->plugin_slug .'-badged-styles', BADGED_URL . 'admin/assets/css/badged.css', array(), self::VERSION );
|
||||
wp_enqueue_style( $this->plugin_slug .'-badged-styles' );
|
||||
}
|
||||
|
||||
// Old Style
|
||||
if ( 'ios6' == $options['style'] ) {
|
||||
wp_enqueue_style( $this->plugin_slug .'-badged-styles', BADGED_URL . 'admin/assets/css/badged-ios6.css', array(), Badged::VERSION );
|
||||
wp_register_style( $this->plugin_slug .'-badged-styles', BADGED_URL . 'admin/assets/css/badged-ios6.css', array(), self::VERSION );
|
||||
wp_enqueue_style( $this->plugin_slug .'-badged-styles' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register and enqueue admin bar specific style sheet.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function enqueue_adminbar_styles() {
|
||||
|
||||
$options = get_option( 'badged_settings' );
|
||||
|
||||
// Default Style
|
||||
if ( 'ios7' == $options['style'] ) {
|
||||
wp_register_style( $this->plugin_slug .'-badged-styles', BADGED_URL . 'admin/assets/css/badged.css', array(), self::VERSION );
|
||||
wp_enqueue_style( $this->plugin_slug .'-badged-styles' );
|
||||
}
|
||||
|
||||
// Old Style
|
||||
if ( 'ios6' == $options['style'] ) {
|
||||
wp_register_style( $this->plugin_slug .'-badged-styles', BADGED_URL . 'admin/assets/css/badged-ios6.css', array(), self::VERSION );
|
||||
wp_enqueue_style( $this->plugin_slug .'-badged-styles' );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ if ( ! defined( 'BADGED_BASENAME' ) ){
|
||||
*
|
||||
*/
|
||||
|
||||
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
||||
//if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
||||
|
||||
require_once( BADGED_PATH . '/admin/class-badged-admin.php' );
|
||||
add_action( 'plugins_loaded', array( 'Badged', 'get_instance' ) );
|
||||
@ -80,4 +80,4 @@ if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
||||
register_activation_hook( $badged_plugin_file, array( 'Badged', 'activate' ) );
|
||||
register_deactivation_hook( $badged_plugin_file, array( 'Badged', 'deactivate' ) );
|
||||
|
||||
}
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user