Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. function lxb_toolbar_styles() {
  2.  
  3. // If you're not logged in, you don't get the toolbar, nor do you need it's styles.
  4. if( ! is_user_logged_in() ) { return FALSE; }
  5.  
  6. // Get the current admin color scheme, so we can load the right styles
  7. $color_scheme = get_user_option( 'admin_color' );
  8.  
  9. // Check and see if we have a corresponding toolbar stylesheet for the current theme
  10. $themes_path = plugin_dir_path( __FILE__ ). 'themes/';
  11.  
  12. $themes = glob( $themes_path . '*.css' );
  13.  
  14. $current_theme_path = plugin_dir_path( __FILE__ ). "themes/toolbar-$color_scheme.css";
  15.  
  16. // If we don't, just load the default
  17. if( !in_array( $current_theme_path, $themes ) ){
  18.  
  19. $color_scheme = 'lexblog_default';
  20. }
  21.  
  22. $url = esc_url( plugins_url ( "themes/toolbar-$color_scheme.css", __FILE__ ) );
  23.  
  24. wp_register_style( 'lxb-toolbar', $url );
  25.  
  26. wp_enqueue_style( 'lxb-toolbar' );
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement