I AM LISTENING TO
|

WHAT I LIKE

Allow SVG files in WordPress Upload Fullpage.js / iScroller Visual Composer Addon for WordPress
WordPress    

Handle WP child-theme functions.php after parent theme



14. March 2015

Normally the functions.php in your CHILD theme is called before the PARENT functions.php. In some cases, you might like to alter functionality loaded through the PARENT theme in your CHILD theme, which is not possible without some changes.

From the WordPress Codex :”Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)”

For our new setup, I am using a base class in our PARENT theme to define all our defaults. Some of the CHILD themes need to overwrite or adjust functionality. This allows to have a pure foundation, than alter and extend as needed.

PARENT functions.php
is extending the TimberSite class in my case, as I am using Timber (TWIG for WordPress) for my themes

CHILD functions.php

Cheers
Alex




Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz