Reputation: 7443
I'm using a theme called "views base." Documentation is here: http://wp-types.com/documentation/views-inside/views-base-theme/views-base-customization/
I've created a child theme and I'm trying to figure out how to add a new widget area to the theme.
The parent theme's functions.php file has this line: require_once('class_base_theme.php');
This file contains a class called "class_base_theme" with a $sidebar_array property with an array of all the widget regions.
I can easily add in a new region in this parent class simply by adding it to the $sidebar_array property. But I can't figure out how to extend and modify this class in the child theme. I can't do it in my child theme's functions.php file because it is called before the parent's functions.php file.
Upvotes: 3
Views: 4392
Reputation: 894
Actually, it depends on the parent theme. If the parent uses if (!class_exists('class_name'))
before loading the class, then it'll work, but if not you're going to get an error trying to redeclare a class. I would suggest extending the class. Make a new php file in your theme, require it, then extend the parent's class that way like Child_Class extends Parent_Class {}
Now, from within your new class Child_Class
you should be able to access $sidebar_array and do whatever you want with it, as well as use the parent's class functions, if needed.
Upvotes: 1