- Author: Scott Reilly
- Version: 2.0.1
- First released: 2011-12-05
- Last update: 2021-05-31
- Compatibility: WP 4.9 – 5.7.9
- Download: [ zip ]
- Description:
Easily define additional CSS (inline and/or by URL) to be added to all administration pages.
-
Extended Description
Ever want to tweak the appearance of the WordPress admin pages by hiding stuff, moving stuff around, changing fonts, colors, sizes, etc? Any modification you may want to do with CSS can easily be done via this plugin.
Using this plugin you’ll easily be able to define additional CSS (inline and/or files by URL) to be added to all administration pages. You can define CSS to appear inline in the admin head (within style tags), or reference CSS files to be linked (via “link rel=’stylesheet’” tags). The referenced CSS files will appear in the admin head first, listed in the order defined in the plugin’s settings. Then any inline CSS are added to the admin head. Both values can be filtered for advanced customization (see Advanced section).
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Hooks
The plugin exposes two filters for hooking. Typically, code making use of filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain). Bear in mind that the features controlled by these filters are also configurable via the plugin’s settings page. These filters are likely only of interest to advanced users able to code.
c2c_add_admin_css (filter)
The ‘c2c_add_admin_css’ filter allows customization of CSS that should be added directly to the admin page head.
Arguments:
- $css (string): CSS styles.
Example:
/** * Add CSS to admin pages. * * @param string $css String to be added to admin pages. * @return string */ function my_admin_css( $css ) { $css .= " #site-heading a span { color:blue !important; } #favorite-actions { display:none; } "; return $css; } add_filter( 'c2c_add_admin_css', 'my_admin_css' );
c2c_add_admin_css_files (filter)
The ‘c2c_add_admin_css_files’ filter allows programmatic modification of the list of CSS files to enqueue in the admin.
Arguments:
- $files (array): Array of CSS files.
Example:
/** * Add CSS file(s) to admin pages. * * @param array $files CSS files to be added to admin pages. * @return array */ function my_admin_css_files( $files ) { $files[] = 'http://yui.yahooapis.com/2.9.0/build/reset/reset-min.css'; return $files; } add_filter( 'c2c_add_admin_css_files', 'my_admin_css_files' );
Find out more at the plugin’s WordPress Plugin Repository page.
-
Screenshots
Click to see full-size image.
-
Installation
- Install via the built-in WordPress plugin installer. Or download and unzip
add-admin-css.zip
inside the plugins directory for your site (typicallywp-content/plugins/
) - Activate the plugin through the ‘Plugins’ admin menu in WordPress
- Go to “Appearance” -> “Admin CSS” and specify some CSS to be added into all admin pages. (You can also use the “Settings” link in the plugin’s entry on the admin “Plugins” page).
- Install via the built-in WordPress plugin installer. Or download and unzip
-
Release Log
2.0.1 (2021-05-30)
- Change: Update plugin framework to 063
- Fix: Simplify settings initialization to prevent conflicts with other plugins
- Change: Remove ability to detect plugin settings page before current screen is set, as it is no longer needed
- Change: Enqueue thickbox during
'admin_enqueue_scripts'
action instead of during'init'
- Change: Use
is_plugin_admin_page()
inhelp_tabs()
instead of reproducing its functionality - Change: Trigger a debugging warning if
is_plugin_admin_page()
is used before'admin_init'
action is fired
- New: Add new string (from plugin framework) for translation
2.0 (2021-05-12)
- Change: Outright support HTML5 rather than check for theme support of HTML5, since that isn’t relevant to admin
- Change: Update plugin framework to 062
- 062:
- Change: Update
is_plugin_admin_page()
to useget_current_screen()
when available - Change: Actually prevent object cloning and unserialization by throwing an error
- Change: Check that there is a current screen before attempting to access its property
- Change: Remove ‘type’ attribute from
style
tag - Change: Incorporate commonly defined styling for inline_textarea
- 061:
- Fix bug preventing settings from getting saved
- 060:
- Rename class from
c2c_{PluginName}_Plugin_051
toc2c_Plugin_060
- Move string translation handling into inheriting class making the plugin framework code plugin-agnostic
- Add abstract function
get_c2c_string()
as a getter for translated strings - Replace all existing string usage with calls to
get_c2c_string()
- Add abstract function
- Handle WordPress’s deprecation of the use of the term “whitelist”
- Change: Rename
whitelist_options()
toallowed_options()
- Change: Use
add_allowed_options()
instead of deprecatedadd_option_whitelist()
for WP 5.5+ - Change: Hook
allowed_options
filter instead of deprecatedwhitelist_options
for WP 5.5+
- Change: Rename
- New: Add initial unit tests (currently just covering
is_wp_version_cmp()
andget_c2c_string()
) - Add
is_wp_version_cmp()
as a utility to compare current WP version against a given WP version - Refactor
contextual_help()
to be easier to read, and correct function docblocks - Don’t translate urlencoded donation email body text
- Add inline comments for translators to clarify purpose of placeholders
- Change PHP package name (make it singular)
- Tweak inline function description
- Note compatibility through WP 5.7+
- Update copyright date (2021)
- 051:
- Allow setting integer input value to include commas
- Use
number_format_i18n()
to format integer value within input field - Update link to coffee2code.com to be HTTPS
- Update
readme_url()
to refer to plugin’s readme.txt on plugins.svn.wordpress.org - Remove defunct line of code
- Change: Use plugin framework’s
is_plugin_admin_page()
instead of reinventing it - New: Add a recommendation for Add Admin JavaScript plugin to settings page
- Change: Output the multiple tips on the settings page as a list instead of multiple paragraphs
- Change: Prevent appending newline to value of setting passed to filter unless an actual value was configured
- Change: Move translation of all parent class strings into main plugin file
- Change: Tweak conditional checks to be more succinct
- Change: Ensure there’s a current screen before attempting to get one of its properties
- Change: Omit inline styles for settings now that plugin framework defines them
- Change: Output newlines after paragraph tags in settings page
- Change: Note compatibility through WP 5.7+
- Change: Update copyright date (2021)
- Change: Change plugin’s short description
- Change: Tweak some readme.txt documentation
- Change: Tweak some inline function and parameter documentation
- Unit tests:
- New: Add tests for JS files getting registered and enqueued
- New: Add tests for
add_codemirror()
- New: Add help function
get_css_files()
- Change: Restructure unit test directories and files into
tests/
top-level directory - Change: Remove ‘test-‘ prefix from unit test files
- Change: In bootstrap, store path to plugin file constant so its value can be used within that file and in test file
1.9.1 (2020-09-25)
- Change: Update plugin framework to 051
- Allow setting integer input value to include commas
- Use
number_format_i18n()
to format integer value within input field - Update link to coffee2code.com to be HTTPS
- Update
readme_url()
to refer to plugin’s readme.txt on plugins.svn.wordpress.org - Remove defunct line of code
- Change: Note compatibility through WP 5.5+
- Change: Restructure unit test file structure
- New: Create new subdirectory
phpunit/
to house all files related to unit testing - Change: Move
bin/
tophpunit/bin/
- Change: Move
tests/bootstrap.php
tophpunit/
- Change: Move
tests/
tophpunit/tests/
- Change: Rename
phpunit.xml
tophpunit.xml.dist
per best practices
- New: Create new subdirectory
- Change: Update plugin framework to 063
-
Copyright & Disclaimer
Copyright © 2011-2023 by Scott Reilly (aka coffee2code)This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -
Discussion / Support
Have any questions, comments, or suggestions? Please provide them via the plugin’s WordPress.org support forum. I’ll do my best to reply in a timely fashion and help as best I can.
Unfortunately, I cannot provide guaranteed support, nor do I provide support via any other means.
Was this plugin useful useful to you? Consider giving it a rating. If you’re inclined to give it a poor rating, please first post to the support forum to give me a chance to address or explain the situation.