No error message, just no changes. The child class is NOT adding the new code. I'm trying to add code to an existing public function using a child class.
I need to extend a parent class to add an extra field.
This is the parent class.
class Default_Fields {
public function fields() {
$this->_fields = array()
array(
'name' => 'text_one',
'label' => __( 'Text One' ),
'type' => 'text',
),
);
}
}
This is the child class
class More_Fields extends Default_Fields {
public function fields() {
$this->_fields = array()
array(
'name' => 'text_one',
'label' => __( 'Text One' ),
'type' => 'text',
),
array(
'name' => 'text_two',
'label' => __( 'Text Two' ),
'type' => 'text',
),
);
}
}
$new = new More_Fields;
$new->fields();
The additional code in the child class for Text Two is not added. Not sure why. What am i missing or is there another method?