Child theme functionality with Graphene Mobile

Child themes are great. They allow you to customise a parent theme without ever needing to edit the parent theme’s files. However, due to the way most mobile theme switcher plugins work, you can’t use child theme with Graphene Mobile the way you usually can with standard desktop themes. This is because the child theme won’t be loaded when the mobile theme is loaded.

However, the Graphene Mobile theme has a feature implemented in it that allows you to have child theme-like functionality. In this post, I will explain how you can use this lesser known feature.

Child themes and Graphene Mobile

Two of the most commonly used files in a child theme is the style.css and the functions.php file. The style.css file is where you place all your custom css styles, whereas the functions.php file is where you place all your custom PHP functions. Child themes also allow you to override the parent theme’s templates, but most of the time you don’t need them to. In fact, I wouldn’t even recommend it, for reasons that you can read about here.

With Graphene Mobile, you can have it load a custom style.css and functions.php files without actually creating a child theme for it. But those are all the custom files it will load. It would not load any other files unless you specifically include() or require() them in the custom functions.php file, or if you import() them in the custom style.css file. It would not also replace any of its template files with any custom template files you may create.

The How To

In order to have the Graphene Mobile theme load up the custom style.css and functions.php files, all you need to do is place those files in the wp-content/uploads/graphene-mobile-custom/. Graphene Mobile will then check if those files exist, and load them if they do.

Like normal child themes, the style.css file will be loaded after the theme’s style.css file, whereas the functions.php file is will be loaded before the theme’s own functions.php file. This allows you to override the theme’s styles and functions more easily.

I would love to hear your thoughts on this feature, so if you have any comments or suggestions, make sure you submit them below. Enjoy!