Make functions.php pluggable (for child themes)
-
Dear DessignThemes developers,
please make One-Blog’s functions.php functions fully pluggable to allow overriding any of them when needed for safe customization via child theme (i.e. one-blog-child).
It doesn’t take too much time to enclose each function in functions.php within an “if ( ! function_exists() )” block, e.g.:
if ( ! function_exists( 'some_function' ) ) { some_function( $params ) { // Do something. } }I’m not actually asking for help because I already managed to successfully solve the issue making one_blog_theme_imports() pluggable (as shown above) in order to override it with a customized version in my one-blog-child. Unfortunately it’s been necessary to make slight changes in the main One-Blog theme’s functions.php (WordPress prepends the child theme’s version of functions.php to the main theme’s one, hence if the main theme’s functions are pluggable they can be safely overridden; otherwise an error is issued because it’s not allowed to declare the same function twice). Now the big problem is that if you don’t provide a functions.php file with pluggable functions (see example above) ASAP my workaround will get lost on the next One-Blog update!
***
I kinda love One-Blog basically because it’s customizable in a straightforward way (though the functions’ API could be better documented and the coding style could be more coherent) but since I’m not using it for a blog I needed to add a second menu to the sidebar. It’s not been too difficult to add the necessary code to the child theme (now a second menu is fully configurable through the standard Appearance -> Menus interface) but I had to enqueue a customized script.js because I needed such brand new menu to be displayed by slicknav (for mobile devices) instead of the standard .head-nav one.
If you won’t provide a functions.php file with pluggable functions I’ll have to fork One-Blog (according to the terms and conditions of the GNU/GPL v3 License) because chances are that applying the next One-Blog update my customer will end up getting a broken website.
If you contact me I’ll be glad to provide you with a fully pluggable function.php. It’s a drop-in replacement fitting the current version of the One-Blog theme — it works seamlessly since each function is intact though being pluggable.
Thank you in advance.
The topic ‘Make functions.php pluggable (for child themes)’ is closed to new replies.
