Jetpack feedback form shortcode!

Is there a way I can create a 'short' shortcode for the feedback form output from jetpack such as the example below?

It's so the novice contributers aren't intimidated or think its a rough edged setup when adding to their page.

Many Thanks
Malc

[contact-form][contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Handicap' type='text' required='1'/][contact-field label='Home Club' type='text' required='1'/][contact-field label='Agree to T%26amp;C%26#039;s' type='checkbox-multiple' options='yes,no'/][/contact-form]

  • Sajid

    Hi Malc,
    Hope you are doing good today :slight_smile:

    Yes, it can be shortened down to just one tag instead of multiple shortcodes that can be confusion for novice/layman users.

    Add following code in functions.php file of your child theme or use it as mu-plugin (recommended).

    function jpcontact_shortcode($atts, $content, $tag){
    
    	$returner = do_shortcode("[contact-form][contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Handicap' type='text' required='1'/][contact-field label='Home Club' type='text' required='1'/][contact-field label='Agree to T%26amp;C%26#039;s' type='checkbox-multiple' options='yes,no'/][/contact-form]");
    
    	return $returner;
    
    }
    add_shortcode('contactus', 'jpcontact_shortcode');

    Now you can simply use below shortcode instead. But please bear in mind that it would not accept any arguments.
    [contactus]

    Take care and have a nice day :slight_smile:

    Kind Regards,
    Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.