Adding a WP SMS Subscriber Form in WordPress

Updated on Apr 28, 2024

In this document, we will show you how to easily add a WP SMS subscriber form to your WordPress website. This form can be used to collect your visitors’ mobile numbers, allowing you to keep them informed and updated through SMS notifications and alerts.

There are four ways to add the WP SMS subscriber form to your website

1. Add the SMS Newsletter through the Gutenberg block

  • Create a new Post or Page in the admin
  • Click the Add Block button.
  • Select the WP SMS widget and add it in the appropriate place.
  • Add the title and description of the form.
  • Click the Publish or Update button.

2. Add the SMS Newsletter through the Widgets

  • Go to Appearance → Widgets.
  • Choose where you want the widget to appear on the site.
  • Click the Add Block button.
  • Select the WP SMS widget.
  • Finally, click on the Update button.

3. Add the SMS Newsletter through the Shortcode

  • Create a new Post or Page in the admin
  • Insert shortcode [wp_sms_subscriber_form title=”SMS Newsletter” description=”” groups=”1,2,…”]
  • Click the Publish or Update button.

4. Add Custom Field and desired groups

The shortcodes also support the custom fields which means you can add your custom fields in the SMS newsletter form. For example:

[wp_sms_subscriber_form title="SMS Newsletter" description="" fields="age:Enter Your Age|country:Enter Your Country"]

Keep in mind that you need to first create the groups and go to SMS → Settings → NewsLetter and enable the Show groups option. This way the group options will be shown on the subscriber form.

Make use of the article on How to Add the SMS Newsletter with Elementor using Shortcode.

5. Add the SMS Newsletter through the PHP function

You can also load the SMS newsletter form with the PHP function in your theme or plugin.

wp_sms_subscriber_form([
    'title' => 'SMS Newsletter form',
    'description' => 'Subscribe to our SMS newsletter to get the latest news and updates delivered directly to your phone.',
]);

You can also add your custom fields in the form with this function like

wp_sms_subscriber_form([
    'title' => 'SMS Newsletter form',
    'description' => 'Subscribe to our SMS newsletter to get the latest news and updates delivered directly to your phone.',
    'fields' => [
        'age' => [
            'label' => 'Age',
            'description' => 'Please enter your age',
            'type' => 'number',
        ],
        'country' => [
            'label' => 'Country',
            'description' => 'Please enter your country',
            'type' => 'text',
        ],
    ]
]);