Payment Forms for Paystack Shortcodes

Below, you’ll find a detailed guide on how to add the Payment Forms for Paystack Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Payment Forms for Paystack Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Payment Forms for Paystack Plugin and the shortcodes it provides:

Plugin Icon
Payment Forms for Paystack

"Payment Forms for Paystack is a seamless WordPress plugin that integrates Paystack payment gateway. With it, you can create custom payment forms, enabling fast, secure transactions on your site."

★★★★✩ (8) Active Installs: 5000+ Tested with: 5.9.8 PHP Version: false
Included Shortcodes:
  • [pff-paystack]
  • [datepicker]
  • [add_shortcode]
  • [kkd_pff_paystack_select_shortcode]
  • [radio]
  • [checkbox]
  • [textarea]
  • [kkd_pff_paystack_input_shortcode]

Payment Forms for Paystack [pff-paystack] Shortcode

The ‘pff-paystack’ shortcode is part of the Payment Forms for Paystack plugin. It creates a payment form for Paystack, a popular payment gateway. This shortcode calls the ‘kkd_pff_paystack_form_shortcode’ function, which generates the Paystack payment form on your WordPress website.

Shortcode: [pff-paystack]

Examples and Usage

Basic example – Showcases a simple usage of the ‘pff-paystack’ shortcode without any additional parameters.

[pff-paystack]

PHP Function Code

In case you have difficulties debugging what causing issues with [pff-paystack] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('pff-paystack', 'kkd_pff_paystack_form_shortcode');

Shortcode PHP function:

f

Code file location:

payment-forms-for-paystack/payment-forms-for-paystack/public/class-paystack-forms-public-for-old-themes.php

Payment Forms for Paystack [datepicker] Shortcode

The ‘datepicker’ shortcode from the Payment Forms for Paystack plugin generates a date picker field. It creates an input field where users can select a date. This shortcode accepts two parameters: ‘name’ and ‘required’. ‘Name’ sets the label for the field, and ‘required’ determines if the field is mandatory.

Shortcode: [datepicker]

Parameters

Here is a list of all possible datepicker shortcode parameters and attributes:

  • name – Defines the title or label for the datepicker field.
  • required – If set to ‘required’, it makes the datepicker field mandatory to fill out.

Examples and Usage

Basic example – A simple date picker form is created with the title “Date”. The ‘required’ attribute is not specified, so the form field will not be mandatory.

[datepicker name="Date" /]

Advanced examples

Creating a mandatory date picker form with the title “Birth Date”. The ‘required’ attribute is set to ‘required’, making the form field mandatory for the user to fill.

[datepicker name="Birth Date" required="required" /]

Creating a date picker form with the title “Event Date”. The ‘required’ attribute is not specified, so the form field will not be mandatory. This example shows how you can change the ‘name’ attribute to suit your form’s needs.

[datepicker name="Event Date" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [datepicker] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('datepicker', 'kkd_pff_paystack_datepicker_shortcode');

Shortcode PHP function:

function kkd_pff_paystack_datepicker_shortcode($atts)
{
    extract(
        shortcode_atts(
            array(
            'name' => 'Title',
            'required' => '0',
            ),
            $atts
        )
    );
    $code = '<div class="span12 unit">
		<label class="label">'.$name;
    if ($required == 'required') {
        $code.= ' <span>*</span>';
    }
    $code.= '</label>
		<div class="input">
			<input type="text" class="date-picker" name="'.$name.'" placeholder="Enter '.$name.'"';
    if ($required == 'required') {
        $code.= ' required="required" ';
    }
    $code.= '" /></div></div>';
    return $code;
}

Code file location:

payment-forms-for-paystack/payment-forms-for-paystack/public/class-paystack-forms-public-for-old-themes.php

Payment Forms for Paystack [add_shortcode] Shortcode

The ‘add_shortcode’ shortcode in the payment-forms-for-paystack plugin creates a custom text input field. It allows for a title and requirement status to be set. The shortcode’s PHP function, ‘kkd_pff_paystack_text_shortcode’, extracts attributes for ‘name’ and ‘required’. It then generates a div element with an input field. If ‘required’ is set, an asterisk is added to the label and the input field is marked as required.

Shortcode: [add_shortcode]

Parameters

Here is a list of all possible add_shortcode shortcode parameters and attributes:

  • name – Defines the title or label of the input field
  • required – Determines if the input field is mandatory or not

Examples and Usage

Basic example – A simple usage of the shortcode to create a text input field with a label named ‘Title’.

Advanced examples

Creating a text input field with a label named ‘Email’ and making it a required field.

Creating a text input field with a label named ‘Username’. This field is not required.

Note: The ‘required’ attribute in the shortcode accepts ‘required’ for required fields and ‘0’ for optional fields. The ‘name’ attribute is used to set the label for the input field.

PHP Function Code

In case you have difficulties debugging what causing issues with [add_shortcode] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('text', 'kkd_pff_paystack_text_shortcode');

Shortcode PHP function:

function kkd_pff_paystack_text_shortcode($atts)
{
    extract(
        shortcode_atts(
            array(
            'name' => 'Title',
            'required' => '0',
            ),
            $atts
        )
    );
    $code = '<div class="span12 unit">
		<label class="label">'.$name;
    if ($required == 'required') {
        $code.= ' <span>*</span>';
    }
    $code.= '</label>
		<div class="input">
			<input type="text" name="'.$name.'" placeholder="Enter '.$name.'"';
    if ($required == 'required') {
        $code.= ' required="required" ';
    }
    $code.= '" /></div></div>';
    return $code;
}

Code file location:

payment-forms-for-paystack/payment-forms-for-paystack/public/class-paystack-forms-public-for-old-themes.php

Payment Forms for Paystack [kkd_pff_paystack_select_shortcode] Shortcode

The Paystack plugin shortcode creates a dropdown select input field in a payment form. It extracts attributes like name, options, and requirement status. The shortcode generates a select field with options provided. If marked as ‘required’, it ensures the field is filled before submission.

Shortcode: [kkd_pff_paystack_select_shortcode]

Parameters

Here is a list of all possible kkd_pff_paystack_select_shortcode shortcode parameters and attributes:

  • name – Defines the title of the select input field.
  • options – Lists the options for the select input field, separated by commas.
  • required – Determines if the select input field is mandatory or optional.

Examples and Usage

Basic example – The following shortcode example demonstrates the basic usage of the ‘select’ shortcode with the ‘kkd_pff_paystack_select_shortcode’ function. It includes the ‘name’ attribute, which defines the title of the selection field, and the ‘options’ attribute, which specifies the options available for selection.

[select name="Payment Method" options="Credit Card,Debit Card,Paypal" /]

Advanced examples

1. The next example demonstrates the use of the ‘select’ shortcode with the ‘required’ attribute set to ‘required’. This makes the selection field mandatory, meaning the user cannot submit the form without making a selection.

[select name="Payment Method" options="Credit Card,Debit Card,Paypal" required="required" /]

2. This example shows the use of the ‘select’ shortcode with a list of more than two options. The options are separated by commas, and each option appears as a separate selection in the dropdown menu.

[select name="Country" options="USA,Canada,UK,Germany,France,Spain,Italy" required="required" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [kkd_pff_paystack_select_shortcode] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('select', 'kkd_pff_paystack_select_shortcode');

Shortcode PHP function:

function kkd_pff_paystack_select_shortcode($atts)
{
    extract(
        shortcode_atts(
            array(
            'name' => 'Title',
            'options' => '',
            'required' => '0',
            ),
            $atts
        )
    );
    $code = '<div class="span12 unit">
		<label class="label">'.$name;
    if ($required == 'required') {
        $code.= ' <span>*</span>';
    }
    $code.= '</label>
		<div class="input">
			<select class="form-control"  name="'.$name.'"';
    if ($required == 'required') {
        $code.= ' required="required" ';
    }
    $code.=">";

    $soptions = explode(',', $options);
    if (count($soptions) > 0) {
        foreach ($soptions as $key => $option) {
            $code.= '<option  value="'.$option.'" >'.$option.'</option>';
        }
    }
    $code.= '" </select><i></i></div></div>';
    return $code;
}

Code file location:

payment-forms-for-paystack/payment-forms-for-paystack/public/class-paystack-forms-public-for-old-themes.php

Payment Forms for Paystack [radio] Shortcode

The ‘radio’ shortcode from the Payment Forms for Paystack plugin allows you to create a radio button form field. It takes parameters for the field’s name, options, and if it’s required. The PHP function ‘kkd_pff_paystack_radio_shortcode’ extracts these attributes and generates the HTML code. It creates a label and a radio button for each option. The first option is pre-selected, and if the field is required, it adds the necessary attribute.

Shortcode: [radio]

Parameters

Here is a list of all possible radio shortcode parameters and attributes:

  • name – Sets the title for the radio input field.
  • options – Specifies the options for the radio buttons, separated by commas.
  • required – Indicates whether the radio input field is mandatory or optional.

Examples and Usage

Basic example – Usage of the shortcode to create a radio button with a single option.

[radio name="Choice" options="Option1" /]

Advanced examples

Using the shortcode to create a radio button group with multiple options. The first option will be selected by default.

[radio name="Choice" options="Option1,Option2,Option3" /]

Creating a required radio button group with multiple options. The radio button group will be marked as required, and the first option will be selected by default.

[radio name="Choice" options="Option1,Option2,Option3" required="required" /]

Creating a radio button group with a single option. The radio button will not be selected by default.

[radio name="Choice" options="Option1" required="0" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [radio] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('radio', 'kkd_pff_paystack_radio_shortcode');

Shortcode PHP function:

function kkd_pff_paystack_radio_shortcode($atts)
{
    extract(
        shortcode_atts(
            array(
            'name' => 'Title',
            'options' => '',
            'required' => '0',
            ),
            $atts
        )
    );
    $code = '<div class="span12 unit">
		<label class="label">'.$name;
    if ($required == 'required') {
        $code.= ' <span>*</span>';
    }
    $code.= '</label>
		<div class="inline-group">
		';
    $soptions = explode(',', $options);
    if (count($soptions) > 0) {
        foreach ($soptions as $key => $option) {
            // $code.= '<option  value="'.$option.'" >'.$option.'</option>';
            $code.= '<label class="radio">
				<input type="radio" name="'.$name.'" value="'.$option.'"';
            if ($key == 0) {
                $code.= ' checked';
                if ($required == 'required') {
                    $code.= ' required="required"';
                }
            }

            $code.= '/>
				<i></i>
				'.$option.'
			</label>';
        }
    }
    $code.= '</div></div>';
    return $code;
}

Code file location:

payment-forms-for-paystack/payment-forms-for-paystack/public/class-paystack-forms-public-for-old-themes.php

Payment Forms for Paystack [checkbox] Shortcode

The ‘checkbox’ shortcode from the Payment Forms for Paystack plugin creates a customizable checkbox field. This shortcode lets you define the name, options, and requirement status of the checkbox. It can be used to create multiple checkboxes, each with a unique value. The first checkbox is automatically checked, and if marked as ‘required’, it must be selected by the user.

Shortcode: [checkbox]

Parameters

Here is a list of all possible checkbox shortcode parameters and attributes:

  • name – The title or label of the checkbox group
  • options – Comma-separated list of checkbox options
  • required – Sets whether a checkbox selection is mandatory or not

Examples and Usage

Basic Example – A simple usage of the shortcode to create a checkbox with options.

[checkbox name="Fruits" options="Apple,Mango,Melon" /]

Advanced Examples

In this example, the shortcode is used to create a checkbox with options. The ‘required’ attribute is set to ‘required’, indicating that the user must select at least one checkbox.

[checkbox name="Fruits" options="Apple,Mango,Melon" required="required" /]

In this further advanced example, the shortcode is used to create multiple checkboxes with different options. The ‘required’ attribute is set to ‘required’ for some checkboxes, indicating that the user must select at least one checkbox.

[checkbox name="Fruits" options="Apple,Mango,Melon" required="required" /]
[checkbox name="Vegetables" options="Carrot,Peas,Broccoli" /]
[checkbox name="Dairy" options="Milk,Cheese,Yogurt" required="required" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [checkbox] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('checkbox', 'kkd_pff_paystack_checkbox_shortcode');

Shortcode PHP function:

function kkd_pff_paystack_checkbox_shortcode($atts)
{
    extract(
        shortcode_atts(
            array(
            'name' => 'Title',
            'options' => '',
            'required' => '0',
            ),
            $atts
        )
    );
    $code = '<div class="span12 unit">
		<label class="label">'.$name;
    if ($required == 'required') {
        $code.= ' <span>*</span>';
    }
    $code.= '</label>
		<div class="inline-group">
		';
    // <div class="unit">
    //                 <div class="inline-group">
    //                     <label class="label">Inline checkbox</label>
    //                     <label class="checkbox">
    //                         <input type="checkbox">
    //                         <i></i>
    //                         Apple
    //                     </label>
    //                     <label class="checkbox">
    //                         <input type="checkbox">
    //                         <i></i>
    //                         Mango
    //                     </label>
    //                     <label class="checkbox">
    //                         <input type="checkbox">
    //                         <i></i>
    //                         Melon
    //                     </label>
    //                     <label class="checkbox">
    //                         <input type="checkbox">
    //                         <i></i>
    //                         Lemon
    //                     </label>
    //                     <label class="checkbox">
    //                         <input type="checkbox">
    //                         <i></i>
    //                         Watermelon
    //                     </label>
    //                 </div>
    //             </div>

    $soptions = explode(',', $options);
    if (count($soptions) > 0) {
        foreach ($soptions as $key => $option) {
            // $code.= '<option  value="'.$option.'" >'.$option.'</option>';
            $code.= '<label class="checkbox">
				<input type="checkbox" name="'.$name.'[]" value="'.$option.'"';
            if ($key == 0) {
                $code.= ' checked';
                if ($required == 'required') {
                    $code.= ' required="required"';
                }
            }

            $code.= '/>
				<i></i>
				'.$option.'
			</label>';
        }
    }
    $code.= '</div></div>';
    return $code;
}

Code file location:

payment-forms-for-paystack/payment-forms-for-paystack/public/class-paystack-forms-public-for-old-themes.php

Payment Forms for Paystack [textarea] Shortcode

The ‘textarea’ shortcode is part of the payment-forms-for-paystack plugin. It generates a customizable textarea field in the payment form. This shortcode takes two attributes – ‘name’ and ‘required’. ‘Name’ sets the title or label of the textarea field, and ‘required’ determines if the field is mandatory.

Shortcode: [textarea]

Parameters

Here is a list of all possible textarea shortcode parameters and attributes:

  • name – Defines the title of the textarea field.
  • required – Determines if the textarea field is mandatory to fill.

Examples and Usage

Basic example – Displays a simple textarea with the default title ‘Title’ and not required to be filled.

[textarea /]

Advanced examples

Display a textarea with a custom title ‘Message’ and set it as required.

[textarea name="Message" required="required" /]

Display a textarea with a custom title ‘Feedback’ and not required to be filled.

[textarea name="Feedback" /]

Display a textarea with the default title ‘Title’ and set it as required.

[textarea required="required" /]

Note: The shortcode parameters ‘name’ and ‘required’ can be used in any order. The ‘name’ parameter is used to customize the title of the textarea, and the ‘required’ parameter is used to set the textarea as required to be filled. If the ‘required’ parameter is not included, the textarea will not be required to be filled.

PHP Function Code

In case you have difficulties debugging what causing issues with [textarea] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('textarea', 'kkd_pff_paystack_textarea_shortcode');

Shortcode PHP function:

function kkd_pff_paystack_textarea_shortcode($atts)
{
    extract(
        shortcode_atts(
            array(
            'name' => 'Title',
            'required' => '0',
            ),
            $atts
        )
    );
    $code = '<div class="span12 unit">
		<label class="label">'.$name;
    if ($required == 'required') {
        $code.= ' <span>*</span>';
    }
    $code.= '</label>
		<div class="input">
			<textarea type="text" name="'.$name.'" rows="3" placeholder="Enter '.$name.'"';
    if ($required == 'required') {
        $code.= ' required="required" ';
    }
    $code.= '" ></textarea></div></div>';
    return $code;
}

Code file location:

payment-forms-for-paystack/payment-forms-for-paystack/public/class-paystack-forms-public-for-old-themes.php

Conclusion

Now that you’ve learned how to embed the Payment Forms for Paystack Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *