Contact Form 7

ska-theme includes compatibility with the popular Contact Form 7 plugin.

With the theme, the default CF7 contact form will have the following appearance out of the box:

The styles utilize the Button, Primary button, Form inputs, Label and Loading presets, as well as Tailwind configuration “warning”, “positive”, “negative” and “info” Theme palettes for styling notices.

If you haven’t gotten around to installing the Contact Form 7 plugin yet, the theme will render a placeholder form for the contact-form-7/contact-form-selector block – this allows theme demos and patterns to include a visual contact form without needing the plugin installed.

To place a contact form on the page, use the Contact Form 7 block. To add Tailwind styles to the form, you can wrap the CF7 block in an Element block and add Tailwind classes that target form elements to that, for example:

[&_.wpcf7-submit]:mt-4

WPAUTOP

By default Contact Form 7 wraps the form elements in a lot of <p> elements and adds many <br> elements.

ska-theme adds the following filter to that:

add_filter('wpcf7_autop_or_not', '__return_false');

Without autop you can create very simplistic CF7 forms, such as:

<label class="half"> Name
    [text* your-name autocomplete:name] </label>

<label class="half"> E-mail
    [email* your-email autocomplete:email] </label>

<label> Title
    [text* your-subject] </label>

<label> Message
    [textarea your-message] </label>

[submit "Send"]

and render the form as a CSS grid:

grid grid-cols-1 sm:grid-cols-2 [&>:not(.half)]:col-span-full gap-4

Copy selector:

ska-blocks:{"skaBlocksSelectors":{"[&_.wpcf7-form]":{"skaBlocksGridColumn":{"v":{"$":{"@":""},"[&>:not(.half)]":{"@":"span-full"}}},"skaBlocksDisplay":{"v":{"$":{"@":"grid"}}},"skaBlocksGridTemplateColumns":{"v":{"$":{"@":"1"},"sm":{"@":"2"}}},"skaBlocksGap":{"v":{"$":{"@":"4"}}}}}}

To disable this functionality you can add a filter to your child theme’s functions.php to turn it back on:

add_filter('wpcf7_autop_or_not', '__return_true', 15);