Add a Custom Field

Adding a custom field to Redux is quite simple. It is important the following code is included before the ReduxFramework object is created.

添加自定义字段到框架是很简单的。以下的代码是重要的,reduxframework对象创建前包含的。

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:

这个调用将是你自己的类。在这个例子中,没有类是必要的。第一,打钩:

1
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.

下一步,包括文件路径,无论它可能是。这是一个例子。

1
2
3
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.

这允许任何类型的overridden场是与您自己的个人使用您的代码

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.

Tagged: custom field

Related Articles

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值