Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Commit

Permalink
Improving pre-mp6 styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mboynes committed Aug 3, 2013
1 parent 399b0f0 commit 27c38f4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
22 changes: 19 additions & 3 deletions includes/class-scpt-font-awesome.php
Expand Up @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion 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/).

Expand Down
3 changes: 2 additions & 1 deletion readme.txt
Expand Up @@ -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 =
Expand All @@ -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 =

Expand Down

0 comments on commit 27c38f4

Please sign in to comment.