project-ar2
project-ar2 copied to clipboard
Child-Theme and functions
I use AR2 with a child theme for my personal modifications. Normaly a theme have one functions.php to handle all functions, but AR2 use an additional folder with additional files to add more functions.
Unfortunately, all my additional modified function files are ignored by WordPress. Or am I doing it wrong? ^^
Which functions are not working from a child theme?
For example the widget.php when I change the Feed-URL, I tried it via my child theme but nothing changes.
I don't think you can just change it that way. You might have to create a new custom WP_Widget
class with the updated feed URL and register it via register_widget()
under the init
action hook. Check widget.php
for examples :)
At http://codex.wordpress.org/Child_Themes#Using_functions.php I found this:
TIP FOR THEME DEVELOPERS. The fact that a child theme’s functions.php is loaded first means that you can make the user functions of your theme pluggable —that is, replaceable by a child theme— by declaring them conditionally. E.g.:
if (!function_exists('theme_special_nav')) { function theme_special_nav() { // Do something. } }
In that way, a child theme can replace a PHP function of the parent by simply declaring it again.
Is this an option for your theme, espacially for the libary folder?
I believe it's more of 'it depends', since putting a conditional statement on every theme function could potentially affect its performance. Other than the method that you have mentioned there are other techniques used to make child theme development possible (eg. action/filter hooks, object-oriented implementations, etc.).