Jump to content
Stef's Coding Community

haymanpl

New Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About haymanpl

  • Rank
    New member
  1. 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
  2. I need to add more code to an existing function located inside the parent class. I'm using code like this but can't get it working : // Parent class Default_Fields { public function fields() { $this->_fields = array() // Default Code } } // Child class More_Fields extends Default_Fields { public function fields() { $this->_fields = array() // Modified Code } } $new = new More_Fields; $new->fields(); The modified code in the child class is an extended version of whats in the parent. The
×
×
  • Create New...