首页 > 解决方案 > 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' ) );
    }
}

标签: phpwordpress

解决方案


推荐阅读