Simple:Press Version 5.5 – Child Themes

update-newsOne of the biggest development efforts in the forthcoming Simple:Press version 5.5 will be child themes. This should usher in an exciting new era of themes for Simple:Press.

Currently, we have themes and overlays which can be defined for a theme and allow easy color customization of a theme. However, each theme is completely standalone and we have been strongly recommending that all users create their own theme if they are going to make any customizations to keep from losing their changes on updates. While this works well and its quite easy to make your own theme based on one of ours, it is less than optimal since if we should make any updates to the core theme, you wont get those updates in your custom theme. We work hard to not require any updates to custom themes, but occasionally WordPress or another WordPress theme or plugin makes a change that requires an update. We have been posting all of these core theme changes for every release on our Codex site.

Still, wouldn’t it be nice to be able to make some minor customizations in CSS or custom functions and still get updates to the core themes? Well, SP Child Themes will be the answer you are looking for. Of course, if you are making wholesale changes to the theme, you may still be better off with your own custom theme. It’s also worth noting that with the introduction of child themes, any SP theme that you are currently using or have with 100% continue to keep functioning. Child themes are just another option for your customization of Simple:Press. But, how do child themes work and how do I take advantage of them? Let’s explore…

First, child themes will have the same directory structure as parent (or current) SP themes. In the main root directory of your child, you will continue to define the theme as normal. Take this example child theme:

Simple:Press Theme Title: Default child
Parent: default
Version: 1.2.6
Theme URI: https://perftesting01.wpvix.com
Description: The Simple:Press default theme featuring traditional forum layout with numerous color layout options
Author: Andy Staines, Steve Klasen and Brandon C
Author URI: https://perftesting01.wpvix.com/custom-simplepress-themes-for-every-need/
Stylesheet: my-child.css
Screenshot: spTheme.jpg
Simple:Press Versions: 5.5 and above

That is a standard SP theme definition with the addition of one line – the Parent: default. This will identify the theme as a child theme with a parent theme of default. The Stylesheet argument still points to your child theme css. It must exist like for a parent theme, even if just an empty file. That’s it, you now have a child theme.

childChild themes will show up in the SP Themes List admin panel like any other theme you can select to use. The one difference which you can see in the screenshot, is that the theme is identified as a child theme of the parent. IF the parent or child theme has overlays available, you will have a dropdown where you can select the overlay to use. You can select a child theme to be your main desktop theme or you can select it to be your phone and/or tablet theme as well. Once you have selected your child theme, you can begin to customize it. If you have made no customizations, it will look identical to parent theme and will continue to receive any updates to the parent theme as it gets them. So what can you do to customize the child theme? Let’s take a look…

If you want to customize any styles from the parent, just add the customized styles to your child theme stylesheet (the one defined in the theme template file). A nice feature of child themes is the that the parent theme css file is loaded first, followed by the child css file. So any changes you make in the child stylesheet will ‘override’ the style defined in the parent theme. So you can make the customizations needed, but still get the rest of the styles from the parent. Any updates to the parent will carry over to the child unless the customization takes precedence.

What about custom functions? Like the stylesheet, the parent spFunctions.php file will be included first, followed by the child spFunctions.php. So you can inherit any functions of the parent plus define your own special child functions. The only caveat here is that you cannot name a function in your child spFunctions.php file the same as a function in the parent. Any updates to the parent will still affect the child.

The same goes for template files. Say you want to make a slight tweak to one of the template files. All you have to do is copy the parent template file down to your theme and make your customizations. The child template file will be loaded instead of the parent, but the rest of the template files will be loaded from the parent. You can do this for as many or as few template files as you like. Another good way to continue to get any SP updates to a core theme but keep your customizations. Obviously if you make drastic css changes and modify every template file, you will be better off creating your own theme vice a child theme.

At the risk of sounding like a broken record, the same applies to icons. If you just want to change out an icon for a custom one, just drop in the images folder of your child theme. It will get used instead of the icon from the parent theme. Its an easy way to customize any number of icons, but continue using the parent for others.

Also, plugin template files and css files will continue to function the same way. The child theme will be searched first and if found will be used. If not found, the parent theme will be searched and if found will be used. If its not found in either the child or parent theme, the file from the plugin will be used.

So in a nutshell – okay a large nutshell – that is child themes and they will be making their appearance in Simple Press 5.5 which should be available very early in June. Any questions on child themes can be answered in our support forum and we will get some detailed information on the Codex.

Read Next

Did you find this article useful? Or do you use Simple:Press today?  If so, please support Simple:Press with a review on WordPress.org.  Every review goes a long way towards bringing other users on board!

Click here to review Simple:Press on wordpress.org

More From Simple:Press

What’s New In Simple:Press Forums 6.6.0

September 9, 2020

Simple:Press Forums 6.6.0 introduces two new major features and a lot of improvements to one of the existing features. And, of course, some bugs were stomped.

Read More

How We Increased Performance On Our Site By 300%

July 4, 2020

A few days ago we moved our site from Liquid Web to our new FireupWP and WPCloudDeploy project platform. This new platform allows us to use dedicated cloud VMs from places like Digital Ocean, Linode and Vultr. We pay the cost of the VMs with no markup which provides huge savings over regular hosts. We…

Read More

New Simple:Press Forum Theme: Modern 2020

March 5, 2020

A new default theme is coming to Simple:Press Forums with the release of Simple:Press Forums 6.5.0. Features of this theme: More modern looking with larger default font sizes and button sizes. Less use of tiny icons More color customization options Better display on mobile More white space Just like our previous default theme, Barebones, you…

Read More

Now Available: SPMS Version 2.7

January 10, 2020

Version 2.7 of Simple:Press Member Subscriptions is now available. It includes more than two dozen fixes and tweaks.

Read More