• First sorry, maybe i did not search quite well, but i was not able to find this. currently i have a custom reservation form, but i placed it in the code editor, it turned out i will use this form at multiple locations, and my question where can i find a tutorial how to create a short code for it? like insted copying rhe html in the editor i would like to use somehing like this [show=”reservation_form”][/show] just an example

Viewing 1 replies (of 1 total)
  • You should create a Child theme to make your changes. If you do not, all of your changes will be lost if you update your theme.

    This is an outline for the shortcode:

    // Shortcode to return a form
    // Usage: [showform]
    function mam_showform_func() {
       $form = '';
       // put code here to add the form HTML to $form
       return $form;
    }
    add_shortcode('showform','mam_showform_func');

    Just put this in your functions.php file and add the form HTML where indicated.

Viewing 1 replies (of 1 total)

The topic ‘How to create a short code for custom form’ is closed to new replies.