How to customise Mu or any WordPress theme

Use a child theme to customise any theme and you will be able to keep your base theme up to date without losing all your modifications.

Almost all themes available for WordPress can be customised in this way. It is a myth to suggest only certain themes support child themes and it is actually very easy to do. So here is a quick guide to creating a child theme using the Mu theme as an example.

You will need a simple text editor like notepad++ and your base parent theme (in this case Mu).

The basics of creating a child theme

1. Create a new folder in wp-content/themes, say something like ‘livingos-mu-child’. This is your child theme folder and the only required file for a child theme to work is style.css.

2. Now create a style.css file in your text editor and add the following header:

/*
Theme Name:     LivingOS Mu CHILD
Theme URI:      http: //themeloom.com/
Description:    A Child Theme for LivingOS Mu
Author:         Your Name
Author URI:     http: //themeloom.com/
Template:       LivingOS_MU
Version:        1.0
*/

/* import parent styles */
@import url("../LivingOS_MU/style.css");

3. Add whatever custom css you need into this file. For example to make the title dissappear you might add the following line to the style.css file in your child theme:

h1{ display:none; }

Of course the beauty of using a child theme is that you can put as much custom css in here as you like, without making any changes to the parent theme’s code. This means that when a new version of the theme is released, perhaps to support new WordPress features, you can up date your theme without loosing all your changes.

All the Mu theme options will still be available in the child theme, and for Mu your custom css will be layered on top of whichever flavour of Mu you have selected in the theme options (Urban, Smooth or Minim).

Going further

4. (Optional) You can also add a functions.php file to your child theme to include custom code for the theme. This is sometimes necessary to support certain plugins or to enable/disable core WordPress features.

If you are using the Mu theme, you could override the base theme options by adding a line of code as follows:

// set base style
update_option( 'mu_style' , 'minim.css' );

This will set the base Mu flavour to use the minim style sheet and prevent users from changing the Mu flavour on which your custom css is based.

5. (Optional) In fact you can also add replacements for any template file into the child theme to override the parent theme. So for example you can create a modified single.php template for displaying Posts, which WordPress will use instead of the one found in the parent theme.

You can read more about Child Themes in the official WordPress documentation.

Downloads

Members of the Loom can download a basic child theme for Mu here:

Leave a Reply

Your email address will not be published. Required fields are marked *