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

Overriding Gallery Margin

The simplest method is to remove the WordPress-injected inline style definitions, so that you can control style completely via the Theme: /** * Remove default gallery shortcode inline styles */ add_filter( ‘use_default_gallery_style’, ‘__return_false’ ); Note that this will remove ALL WordPress-injected gallery CSS definitions, so you may need to port some of the original style … Read more

Hiding certain panels in dashboard

@joesk isn’t quite correct. If you simply want to hide a meta box or two on the post-editing screen, you can do that via the Screen Options tab at the top of most screens. If it’s not aesthetic to your personal preferences and you’d like to remove the ability to edit the Excerpt at all, … Read more

How can I insert HTML attributes with an existing TinyMCE button?

The following workaround is based on the wpeditimage/plugin.js file in the core. You could enqueue it or test it with: add_action( ‘admin_footer-post.php’, function() {?><script> jQuery(window).load( function( $ ) { if( ! $( “#wp-content-wrap”).hasClass(“tmce-active” ) ) return; var editor = tinyMCE.activeEditor; editor.on( ‘BeforeExecCommand’, function( event ) { var node, DL, cmd = event.command; if ( cmd … Read more

Get parent category class in post_class()

Perhaps something like: function mytheme_get_post_class_parent_cats() { $parent_cat_classes = array(); // Get parent categories $post_cats = wp_get_post_categories(); // Loop through post categories foreach ( $post_cats as $post_cat ) { $cat_parents = get_category_parents( $post_cat , false, ‘,’, true ); // if there are any parent categories if ( $cat_parents ) { // create an array $cat_array = … Read more

How to implement different color schemes in your themes

I would put all the common css in the theme’s style.css, and create separate stylesheets for the color options. I would also put color options in their own folder with the images for that style. This way you can keep the filenames the same between color options to make maintaining the code a little easier. … Read more