How to override parent global variable
-
If I wanted to add more items to an array called $meta_box that was being created in the parents functions.php, how can I accomplish this? PARENTS FUNCTIONS.PHP EX. $meta_box = array( 'id' => 'my-meta-box2', 'title' => __('Event Information'), 'page' => 'event', 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => __('Date of Event'), 'desc' => __('Enter the date of event.'), 'id' => 'eventdate', 'type' => 'text', 'std' => "" ) ) ); // Add meta box function mytheme_add_box2() { global $meta_box; add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box2', $meta_box['page'], $meta_box['context'], $meta_box['priority']); } so in the child theme I want to add 2 more items $meta_box = array( 'id' => 'my-meta-box2', 'title' => __('Event Information'), 'page' => 'event', 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => __('Date of Event'), 'desc' => __('Enter the date of event.'), 'id' => 'eventdate', 'type' => 'text', 'std' => "" ), array( 'name' => __('Time of Event'), 'desc' => __('Enter the time(s) of the event.'), 'id' => 'eventtime', 'type' => 'textarea', 'std' => "" ), array( 'name' => __('Google Map Link'), 'desc' => __('Enter the url for the google map link (leave blank to disable).'), 'id' => 'eventmaplink', 'type' => 'text', 'std' => "" ) );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to override parent global variable’ is closed to new replies.