Adding a custom field to Redux is quite simple. It is important the following code is included before the ReduxFramework object is created.
Hook into the overload filter
Ideally, this call would be made in your own class. In this example, no class is needed. First, run the hook:
add_filter( "redux/{$YOUR_OPT_NAME}/field/class/edd_license", "overload_edd_license_field_path" ); // Adds the local field
The overload function
Next, include the file path, wherever it may be. Here’s an example.
public function overload_edd_license_field_path($field) { return dirname(__FILE__).'/edd_license/field_edd_license.php'; }
This allows any field type to be overridden with your own code using your individual opt_name
.
Override an existing field
With the code above you can also overload any core field within Redux with one of your own. Make sure the class names match, and you can modify an existing field without actually touching the core code.
Use the extension boilerplate
To make your life much easier, you can use the extension boilerplate. It will be a great starting point to see how to build a custom Redux field. You will also need to utilize the extension loader in order to make your custom field operable.