php - Wordpress 联系 Foprm 7
问题描述
我正在尝试创建一个标签,但是当我输入 [clock] 时,它对我不起作用。我正在使用样板模板创建一个插件。你知道为什么吗?谢谢!
类-rncf.php
private function define_admin_hooks() {
$plugin_admin = new Rncf_Admin( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
$this->loader->add_action( 'wpcf7_init', $plugin_admin, 'rnfc_init' );
}
类-rncf-admin.php
public function rnfc_init(){
function custom_add_form_tag_clock() {
wpcf7_add_form_tag( 'clock', 'custom_clock_form_tag_handler' ); // "clock" is the type of the form-tag
}
function custom_clock_form_tag_handler( $tag ) {
return date_i18n( get_option( 'time_format' ) );
}
}
解决方案
推荐阅读
- javascript - 我们不能使用普通的 Ember 对象来代替 Ember Mixin 吗?
- swift - SwiftUI 列表中的自定义按钮
- c# - 构建错误:“ResolveTargetingPackAssets”任务意外失败
- javascript - 并行和定时运行自定义 NPM 命令
- java - Java Bean 验证在 Spring 存储库中无法按预期工作
- javascript - 使经典的 javascript 3rd 方应用程序在现有的 react/node 应用程序中工作
- python - 根据不同列表的idx属性对列表进行排序
- java - 有没有办法让 TableView 在 TornadoFX 中的其他元素上“浮动”
- javascript - React 如何将一个组件及其 props 传递给另一个组件
- c# - 如何打印带有图片框和标签的面板?