I would like to add custom CSS for several WordPress plugins I have in development. After some Googling around, I managed to find this bit of code:
function namespace_custom_style() {
wp_register_style('namespace', plugins_url('namespace/style/style.css'));
wp_enqueue_style('namespace');
}
add_action('init', 'namespace_custom_style');
The issue with this, however, is that the styling made in this included file is used across the entire WordPress backoffice, whereas I would like unique styling per plugin. For example:
- For Plugin A I would like to have the meta-box be placed below the publish box, as it only has minor extra fields.
- For Plugin B this would not make sense, as this plugin allows users to select custom styling, such as the position of a child-element, colours, etc. As such, I would like to keep it below the MCE to make better use of the wider space.
I am aware that there exists an element with the ID [plugin_name]_meta that I can style to my hearts-content, so if the above is not an option I can do some hocus-pocus on that.
So in short: Is it possible to give simple WordPress plugins their own unique look-and-feel, and how?
If it's necessary for me to provide extra information, do not hesitate to ask.
wp_enqueue_scriptshook (not theinithook), and 2. You can do the whole thing inwp_enqueue_style(...)(you don't need to register on one line, then enqueue on another. wp_enqueue_style supports the same arguments aswp_register_style, and also enqueues the style.