Best practice when modifying plugins CSS [duplicate]

Any changes you make to the plugin’s stylesheet will be overwritten when you update the plugin. Likewise with an edit to the theme’s stylesheet. Even if you create your own stylesheet and enqueue it via functions.php you will have redo the enqueueing when you update. Of course, if this is a theme (or child theme) … Read more

Plugins not showing up for custom template

Always Put wp_head() in header and wp_footer() in footer. the plugin uses this hook Header.php: <?php … /* Always have wp_head() just before the closing </head> * tag of your theme, or you will break many plugins, which * generally use this hook to add elements to <head> such * as styles, scripts, and meta … Read more

Disable CSS for IE 8 and earlier.

Deregister twentytwelve-ie, which is registered (currently) in function.php on line 157. function dereg_ie_styles_wpse_99631() { wp_deregister_style(‘twentytwelve-ie’); } add_action( ‘wp_enqueue_scripts’, ‘dereg_ie_styles_wpse_99631′, 1000); That isn’t just IE8 though. It is registered as less than or equal to IE 9. If you want to remove all of the stylesheets for IE8 or less you are in for a bumpy … Read more

Add background image/layout for single page?

This assumes that you want to add a background image for a specific page: Create your CSS class for the background you want. body.custombg {background: url(“images/background.gif”); } In the header, you can use something like this to check for a specific page. <body <?php if(is_page(123)) echo ‘class=”custombg”‘ ?>> See Conditional Tags for more ideas of … Read more

How to change widget’s form color in admin?

Register/enqueue an admin stylesheet function my_admin_theme_style() { wp_enqueue_style(‘my-admin-theme’, get_template_directory_uri().’/admin-style.css’); } add_action(‘admin_enqueue_scripts’, ‘my_admin_theme_style’); Then add rules of the form #widget-list div[id*=”_archives-“], div[id*=”_archives-“] { background:red; } Consider that proof of concept. I will leave it up to you to target the precise elements you want.

wp nav menu: show submenu below li item

It is possible to change the output of the menu, by creating a new menu Walker. I wouldn’t recommend this solution, however, since you’re attempting to do something that’s actually invalid HTML – the ul tag should only have li tags inside it, never anything else. I know it’s possible to create the solution you’re … Read more

conditional: if is page, and all subpages

Use get_ancestors to get the page parent, then check against that value instead of checking against the name. $ancestors = array(); $ancestors = get_ancestors($post->ID,’page’); $parent = (!empty($ancestors)) ? array_pop($ancestors) : $post->ID; if (!empty($parent)) { switch ($parent){ case 1 : // menu for parent page ID 1 break; case 2 : // menu for parent page … Read more

Load stylesheet in edit category page?

The way to enqueue admin styles and scripts in targeted pages is explained here: Difference between do_action(‘admin_enqueue_scripts’, $hook_suffix) and do_action(“admin_print_styles-$hook_suffix”) syntax The Category page is the same as the Tag page, /wp-admin/edit-tags.php. So, an extra check is needed and in this case using the global variable $current_screen. add_action( ‘admin_print_styles-edit-tags.php’, function(){ global $current_screen; // Not categories, … Read more