diff --git a/includes/class-scpt-font-awesome.php b/includes/class-scpt-font-awesome.php index 8a71943..610f023 100644 --- a/includes/class-scpt-font-awesome.php +++ b/includes/class-scpt-font-awesome.php @@ -83,13 +83,27 @@ public function register_font_awesome() { if ( ! isset( $this->styles['base'] ) ) { $this->styles['base'] = " @font-face { font-family: 'FontAwesome'; src: url('{$this->font_dir}fontawesome-webfont.eot?v=3.1.0'); src: url('{$this->font_dir}fontawesome-webfont.eot?#iefix&v=3.1.0') format('embedded-opentype'), url('{$this->font_dir}fontawesome-webfont.woff?v=3.1.0') format('woff'), url('{$this->font_dir}fontawesome-webfont.ttf?v=3.1.0') format('truetype'), url('{$this->font_dir}fontawesome-webfont.svg#fontawesomeregular?v=3.1.0') format('svg'); font-weight: normal; font-style: normal; } - %s { font-family: FontAwesome !important; -webkit-font-smoothing: antialiased; background: none; *margin-right: .3em; } - %s { font-family: FontAwesome !important; }"; + %s { font-family: FontAwesome !important; -webkit-font-smoothing: antialiased; background: none; *margin-right: .3em; " . $this->pre_mp6_styles() . " } + %s { font-family: FontAwesome !important; } + %s { " . $this->pre_mp6_styles( 'hover' ) . " } + %s { " . $this->pre_mp6_styles( 'open' ) . " }"; add_action( 'scpt_plugin_icon_css', array( $this, 'output_font_awesome' ) ); } } + public function pre_mp6_styles( $state = 'normal' ) { + if ( function_exists( 'mp6_force_admin_color' ) ) + return; + if ( 'normal' == $state ) + return 'font-size:18px;text-align:center;line-height:28px;color:#888;'; + elseif ( 'hover' == $state ) + return 'color:#d54e21;'; + elseif ( 'open' == $state ) + return 'color:#fff;'; + } + + /** * Output relevant styles for Font Awesome * @return type @@ -103,10 +117,12 @@ public function output_font_awesome() { $temp = "#adminmenu #menu-posts-{$post_type} div.wp-menu-image"; $normal[] = $temp; $before[] = $temp . ':before'; + $hover[] = "#adminmenu #menu-posts-{$post_type}:hover div.wp-menu-image"; + $open[] = "#adminmenu #menu-posts-{$post_type}.wp-menu-open div.wp-menu-image"; $hex = $this->get_font_awesome_icon( $icon ); $content .= "\n#adminmenu #menu-posts-{$post_type} div.wp-menu-image:before { content: '{$hex}' !important; }"; } - $content = sprintf( $this->styles['base'], implode( ',', $normal ), implode( ',', $before ) ) . $content; + $content = sprintf( $this->styles['base'], implode( ',', $normal ), implode( ',', $before ), implode( ',', $hover ), implode( ',', $open ) ) . $content; set_transient( $cache_key, $content, HOUR_IN_SECONDS ); } echo $content; diff --git a/readme.md b/readme.md index c0e22ca..d85fea2 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # SuperCPT -**Notice: master on this repo is a nightly build so use with care. Presently, it requires the [MP6 plugin](http://wordpress.org/plugins/mp6/) to properly leverage the icons.** +**Notice: master on this repo is a nightly build so use with care.** WordPress Plugin to build insanely easy and attractive custom post types, custom post meta, and custom taxonomies. Install it from the [WordPress.org Plugin Repository](http://wordpress.org/extend/plugins/super-cpt/). diff --git a/readme.txt b/readme.txt index 0ac1829..beb9487 100644 --- a/readme.txt +++ b/readme.txt @@ -151,6 +151,7 @@ Here is the full demo code: * Fixed bug where CSS/JS doesn't load if plugin is in mu-plugins (props to Aaron Holbrook) * Added magic methods for accessing and setting taxonomy and post type attributes after declaration * Added "media" field type +* Numerous bug fixes = 0.1 = @@ -177,7 +178,7 @@ You probably shouldn't. Check out [Custom Post Type UI](http://wordpress.org/ext = 0.2 = -Removed glyphicons in favor of Font Awesome. If you're using a version of WordPress less than 3.7, you should use the MP6 plugin to update your dashboard design. Otherwise, you should either use SuperCPT 0.1.3 or not use the included icons. +Removed glyphicons in favor of Font Awesome. If you're using a version of WordPress less than 3.7, you should use the MP6 plugin to update your dashboard design for best results. = 0.1.3 =