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
1 2 3 4 5 6 7 8 9 10 11 |
class cubicFusionBase extends TimberSite { function __construct(){ parent::__construct(); } } // If no CHILD theme is loading init the parent class if(CHILD_THEME_LOADED != 1){ new cubicFusionBase(); } |
CHILD functions.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// Do not init the parent class define("CHILD_THEME_LOADED", 1); // Wait for theme setup to be finished add_action( 'after_setup_theme', function() { // Extend parent theme class class cubicFusionChild extends cubicFusionBase { function __construct() { // Call parent class constructor parent::__construct(); } /* Add or extend any other functionality here */ } // Init Child class new cubicFusionChild(); }, 42 ); |
Cheers
Alex
At portalZINE TV we produce Internet TV since 2008. “Das Magazin” is our flagship magazine format that started in 2010 and was broadcasted via satellite for over 3 years (Tec Time TV).
All sections are back up, including the portfolio. Doing a final cleanup and than I can move over to portalZINE TV for the bigger cleanup ;)
Cheers
Alex
I have been working on a full integration of fullpage.js into Visual Composer for WordPress. This allows to easily build fullpage layouts, with different pages and full slide capabilities. Also added iScroller functionality, to allow overflow content to work nicely on certain pages. All of this is working with simple drag & drop :) and can be used by any unexperienced user.
I am currently cleaning up the addon, but I am not sure yet if I will offer it as a commercial addon or keep it for my internal projects only :)
Will post a video later this week.
Cheers
Alex
This website and connected services are currently in a transition phase. We are redesigning everything and making some big changes.
Other areas will follow in the coming days.
Cheers
Alex
A couple of interesting links for the PCTV Broadway HD S2
Currently reading up on the IMAP protocol, as one of my customers is using a server without IMAP support compiled :)
I will be using a simple INBOX check for failed email notifications (sockets are your best friend). That will allow me to set a flag for every new user account that is still unconfirmed and used a broken email address for their registration. These accounts can than be verified manually :)
Happy socket = happy customer.
Btw, here is a nice piece of code to quickly parse the email header in PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$parsed = array(); $blocks = preg_split('/\n\n/', $response['data']); $lines = array(); $matches = array(); foreach ($blocks as $i => $block) { $parsed[$i] = array(); $lines = preg_split('/\n(([\w.-]+)\: *((.*\n\s+.+)+|(.*(?:\n))|(.*))?)/', $block, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($lines as $line) { if(preg_match('/^\n?([\w.-]+)\: *((.*\n\s+.+)+|(.*(?:\n))|(.*))?$/', $line, $matches)) { $parsed[$i][$matches[1]] = preg_replace('/\n +/', ' ', trim($matches[2])); } } } |
Time to give all our network sites some fresh paint :)
Cheers
Alex