Tag Archives: WordPress

Child Themes in WordPress

If you update a modified WordPress template, for security patches etc.,  then your modifications will be lost as the template files will be overwritten during the update. However, if you create a child theme, you can update the parent theme and keep your changes.

Creating a Child Theme

child-theme-directory-structureTo create a child theme, first create a new directory in your themes directory. The themes directory is located at wp-content/themes. The  directory name should not include any spaces as part of the name and following common practice should preferably use the name of the parent theme folder with “-child” appended to it. For example, if you are making a child of the twentyeleven theme, your folder name would be twentyeleven-child.

A stylesheet file named style.css is then created and saved to the child theme directory. This is the only file required to make a child theme and it must start with the following lines:

/*
 Theme Name:   Twenty Eleven Child
 Theme URI:    http://mydomain.com/twentyeleven-child/
 Description:  Twenty Eleven Child Theme
 Author:       Fred Bloggs
 Author URI:   http://mydomain.com
 Template:     twentyeleven
 Version:      1.0.0
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fourteen-child
*/

@import url("../twentyeleven/style.css");

/* =Theme customization starts here
-------------------------------------------------------------- */

You can change each of these lines to suit your theme. The only required lines are the Theme Name, and the Template. The Template is the directory name of the parent theme. In this case, the parent theme is the TwentyEleven theme, so the Template is twentyeleven.

Because the child theme’s stylesheet is included after the parent theme’s then it’s styles will override those in the parent theme’s stylesheet (which is why they’re called cascading style sheets)

To activate the child theme, log in to your site’s dashboard, and go to Appearance > Themes. Here you will see your child theme listed and you click ‘Activate’ to use it.

 

Websites made easy

For a long time now I’ve been recommending that website owners use a content management system (CMS) rather than have a series of linked static pages. The main advantage is that it makes the website content easy to maintain by non technical users for both changing and adding content. Regular updates to your website make it more interesting for visitors, encourage them to return and help in search engine rankings. If you’ve used MS Word or any other word processor then you can easily use a CMS.

CMS Made SimpleAll of my Touchline clients’ websites have been converted to use an open source CMS from Joomla!, CMS Made Simple or WordPress. The chosen solution depends on the type of website. For a very quick and simple CMS, WordPress is a good choice (now used for this website) and there are lots of good commercial and open source templates available. For a more bespoke look, that is still easy to use, I recommend CMS Made Simple which I find ideal for converting static websites as the templates are straightforward to develop. This is demonstrated in the Shotokan Worcester website and its sister (or should it be mother) website for the International Japan Karate-Do Association.

Joomla! is more suitable for content rich websites and is used for the colloborative group website for Advanced Power Generation Technology Forum.

JoomlaAny of these systems can be installed for you and if you’re interested you can develop your own look and feel or Touchline can provide recommendations and bespoke development.