Plugin / Add Admin CSS

Scott Reilly

Frequently Asked Questions (FAQ)

Yes, via the “Admin CSS Files” input field on the plugin’s settings page.
No, not presently. At least not directly. By default, the CSS is added for every admin page on the site. However, you can preface your selectors with admin page specific class(es) on ‘body’ tag to ensure CSS only applies on certain admin pages. (e.g. body.index-php h2, #icon-index { display: none; }). Or, you can hook the ‘c2c_add_admin_css’ and ‘c2c_add_admin_css_files’ filters and determine the current admin page content to decide whether the respective hook argument should be returned (and thus output) or not.
No, not presently. At least not directly. By default, the CSS is added for any user that can enter the admin section of the site. You can hook the ‘c2c_add_admin_css’ and ‘c2c_add_admin_css_files’ filters and determine the current user to decide whether the respective hook argument should be returned (and thus output) for the user or not.
It is certainly possible that you can put yourself in an unfortunate position by supplying CSS that could hide critical parts of admin pages, making it seeminly impossible to fix or revert your changes. Fortunately, there are a number of approaches you can take to correct the problem. The recommended approach is to visit the URL for the plugin’s settings page, but appended with a special query parameter to disable the output of its JavaScript. The plugin’s settings page would typically be at a URL like https://example.com/wp-admin/themes.php?page=add-admin-css%2Fadd-admin-css.php. Append &c2c-no-css=1 to that, so that the URL is https://example.com/wp-admin/themes.php?page=add-admin-css%2Fadd-admin-css.php&c2c-no-css=1 (obviously change example.com with the domain name for your site). There are other approaches you can use, though they require direct database or server filesystem access: Some browsers (such as Firefox, via View -> Page Style -> No Style) allow you to disable styles for sites loaded in that tab. Other browsers may also support such functionality natively or through an extension. Chrome has an extension called Web Developer that adds the functionality. If you’re familiar with doing so and have an idea of what CSS style you added that is causing problems, you can use your browser’s developer tools to inspect the page, find the element in question, and disable the offending style. In the site’s wp-config.php file, define a constant to disable output of the plugin-defined JavaScript: define( 'C2C_ADD_ADMIN_CSS_DISABLED', true );. You can then visit the site’s admin. Just remember to remove that line after you’ve fixed the CSS (or at least change “true” to “false”). This is an alternative to the query parameter approach described above, though it persists while the constant remains defined. There will be an admin notice on the plugin’s setting page to alert you to the fact that the constant is defined and effectively disabling the plugin from adding any CSS. Presuming you know how to directly access the database: within the site’s database, find the row with the option_name field value of c2c_add_admin_css and delete that row. The settings you saved for the plugin will be deleted and it will be like you’ve installed the plugin for the first time. If your server has WP-CLI installed, you can delete the plugin’s setting from the commandline: wp option delete c2c_add_admin_css The initial reaction by some might be to remove the plugin from the server’s filesystem. This will certainly disable the plugin and prevent the CSS you configured through it from taking effect, restoring the access and functionality to the backend. However, reinstalling the plugin will put you back into the original predicament because the plugin will use the previously-configured settings, which wouldn’t have changed.
The plugin’s syntax highlighting of CSS (available on WP 4.9+) honors the built-in setting for whether syntax highlighting should be enabled or not. To disable syntax highlighting, go to your profile page. Next to “Syntax Highlighting”, click the checkbox labeled “Disable syntax highlighting when editing code”. Note that this checkbox disables syntax highlighting throughout the admin interface and not just specifically for the plugin’s settings page.
Yes.

Ratings

4.9
25 reviews

Rating breakdown

Details Information

Version

1.7

First Released

19 Nov, 2011

Total Downloads

59,493

Wordpress Version

4.7 or higher

Tested up to:

5.1.3

Require PHP Version:

-

Tags

Contributors

Languages

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.