Override CSS settings of plugins

Will be interesting know which answer developers think is ‘better’, so as an alternative to Johanne’s answer (which can present difficulties if the plug-in loads scripts late, or starts moving them around without warning) Prevent the stylesheet from loading If you’ve included all necessary styling in your style.css then you can prevent the plug-in’s stylesheet … Read more

adding a custom css class to post

Note – I recommend using the hook suggested by @Chip Bennett in another answer Here’s the modified version of that filter – function wpse_filter_post_class( $classes ) { $my_post_class = get_post_meta($post->ID, “your_meta_name”); if( $my_post_class != ” ) $classes[] = $my_post_class; return $classes; } add_filter( ‘post_class’, ‘wpse_filter_post_class’ ); You can setup a Custom fileds for that – … Read more

Adding style sheet to specific page

Utilize the wordpress conditional tags to selectively enqueue / load your stylesheets. This is best practice so you can call any dependancies as well. I’ve provided an example of this in practice. Often we only want to include styles for the front page and then style accordingly to your sub page: <?php // Is this … Read more

What is the best way to provide plugin users with a way to customized the styles

Is it possible? Yes. Option 1 Simply register and enqueue your default stylesheet. The theme stylesheet can then be used to override whatever styles you implemented. function register_my_styles() { wp_register_style( ‘default-style’, plugins_url(‘default.css’, __FILE__) ); wp_enqueue_style( ‘default-style’ ); } add_action( ‘wp_enqueue_scripts’, ‘register_my_styles’ ); Option 2 Register whatever custom options you need either on a specific plugin … Read more

how to make stylesheet appear in theme editor?

I’d say it’s impossible… For one, there’s no hook inside the file /wp-admin/theme-editor.php. And last but not least, if you try one of this, it dumps an error: /wp-admin/theme-editor.php?file=css%2Fstyle.css&theme=twentyeleven /wp-admin/theme-editor.php?file=css/style.css&theme=twentyeleven Case you find a workaround, this code injects a link to the desired file: /** * Adjust the if(‘Twenty Eleven’ == sel) to your theme … Read more

How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?

WordPress doesn’t really offer this functionality. You basically grab the array of enqueued scripts + styles and minify & concatenating them before they are output (using 3rd party script), of course you would want to cache this as well. This is quite complicated so I suggest instead: There are several plugins on wordpress.org that do … Read more