• Hi,
    I want to make plugin with new shortcode for contact-form-7(Version 4.3) like :

    if (!class_exists('nsnSourceSelection')) {    // nsn-source-selection
        class nsnSourceSelection {
            public function __construct()
            {
                DEFINE('nsnSourceSelection', true); // Pluging is inited
                add_action('plugins_loaded', array($this, 'init'), 120);
            } // function nsnSourceSelection() // constructor of plugin class
    
            public function init() {
                if(function_exists('wpcf7_add_shortcode')){
                    wpcf7_add_shortcode('nsnsourceselection', array($this, 'nsnsourceselection_shortcode_handler'), true);
                    wpcf7_add_shortcode('nsnsourceselection*', array($this, 'nsnsourceselection_shortcode_handler'), true);
    
                }
                add_filter('wpcf7_validate_nsnsourceselection', array($this, 'nsnsourceselection_validation'), 10, 2);
                add_filter('wpcf7_validate_nsnsourceselection*', array($this, 'nsnsourceselection_validation'), 10, 2);
                add_filter( 'wpcf7_validate_favourite-song*', 'custom_favourite_song_validation_filter', 20, 2 );
                if ( is_admin() ) { // That is admin page
                    add_action('admin_init', array($this, 'add_tag_source_selection_generator'), 25);

    In contact Editor form I have button registered and clicking it form is opened in which I genarate my selection input with dynamic data. It has next synttax :

    [nsnsourceselection * favourite-song-category id:id-favourite-song-category  type_of_selection:dropdown source_function:nsn_get_artists_songs_categories sort:post_title  option_value_field:ID option_label_field:name select_label:"Favourite Song's Category"  class:" favouritesongcategory"  "XZcvZ"]

    Problems are :
    1) As function nsnsourceselection_validation defined as validation handler in this function I get $tag parameter with empty elaments name, options.
    I think the reason on these parameters empty is invalid format of my syntax above. Is it so?
    Could yoy clarify what is wrong in syntax?

    also I read syntax doc from here http://contactform7.com/tag-syntax/#mail_tag, could you please give reference to syntax rules here?
    As example I use dynamic-select-extension: https://github.com/Hube2/contact-form-7-dynamic-select-extension

    2) Changing some parameters in my tag syntax very often I do not see my selection input in resulting page at all.
    Ex: If in syntax above to remove 2 options at end, like:

    [nsnsourceselection * favourite-song-category id:id-favourite-song-category  type_of_selection:dropdown source_function:nsn_get_artists_songs_categories sort:post_title  option_value_field:ID option_label_field:name  "XZcvZ"]

    I saw only text of this tag in page , but not control input…

    What wrong in my syntax?

    Thanks!

    https://ww.wp.xz.cn/plugins/contact-form-7/

The topic ‘Error in shortcode syntax for contact-form-7’ is closed to new replies.