Permalink
Browse files

Moved CSS to external file. Added file for < WP 3.3 backwards compat.

  • Loading branch information...
coenjacobs committed Apr 7, 2012
1 parent 53ba912 commit 11c255c92ff70201e00eafb72480aa684729282c
Showing with 54 additions and 29 deletions.
  1. +21 −0 css/wordpress-3-1.css
  2. +25 −0 css/wordpress-3-3.css
  3. +8 −29 stick-admin-bar-to-bottom.php
View
@@ -0,0 +1,21 @@
+* html body {
+ margin-top: 0 !important;
+}
+
+body.admin-bar {
+ margin-top: -28px;
+ padding-bottom: 28px;
+}
+
+body.wp-admin #footer {
+ padding-bottom: 28px;
+}
+
+#wpadminbar {
+ top: auto !important;
+ bottom: 0;
+}
+
+#wpadminbar .quicklinks .menupop ul {
+ bottom: 28px;
+}
View
@@ -0,0 +1,25 @@
+* html body {
+ margin-top: 0 !important;
+}
+
+body.admin-bar {
+ margin-top: -28px;
+ padding-bottom: 28px;
+}
+
+body.wp-admin #footer {
+ padding-bottom: 28px;
+}
+
+#wpadminbar {
+ top: auto !important;
+ bottom: 0;
+}
+
+#wpadminbar .quicklinks .ab-sub-wrapper {
+ bottom: 28px;
+}
+
+#wpadminbar .quicklinks .ab-sub-wrapper ul .ab-sub-wrapper {
+ bottom: -7px;
+}
@@ -8,38 +8,17 @@
*/
function stick_admin_bar_to_bottom_css() {
- echo "
- <style type='text/css'>
- * html body {
- margin-top: 0 !important;
- }
-
- body.admin-bar {
- margin-top: -28px;
- padding-bottom: 28px;
- }
-
- body.wp-admin #footer {
- padding-bottom: 28px;
- }
-
- #wpadminbar {
- top: auto !important;
- bottom: 0;
- }
-
- #wpadminbar .quicklinks .ab-sub-wrapper {
- bottom: 28px;
- }
+ $version = get_bloginfo( 'version' );
- #wpadminbar .quicklinks .ab-sub-wrapper ul .ab-sub-wrapper {
- bottom: -7px;
+ if ( version_compare( $version, '3.3', '<' ) ) {
+ $css_file = 'wordpress-3-1.css';
+ } else {
+ $css_file = 'wordpress-3-3.css';
}
- </style>
- ";
+ wp_enqueue_style( 'stick-admin-bar-to-bottom', plugins_url( 'css/' . $css_file, __FILE__ ) );
}
-add_action('admin_head', 'stick_admin_bar_to_bottom_css');
-add_action('wp_footer', 'stick_admin_bar_to_bottom_css');
+add_action( 'admin_init', 'stick_admin_bar_to_bottom_css' );
+add_action( 'wp_enqueue_scripts', 'stick_admin_bar_to_bottom_css' );
?>

0 comments on commit 11c255c

Please sign in to comment.