Lead Form Builder Shortcode

Below, you’ll find a detailed guide on how to add the Lead Form Builder Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Lead Form Builder Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Lead Form Builder Plugin and the shortcodes it provides:

Plugin Icon
Responsive Contact Form Builder & Lead Generation Plugin

"Responsive Contact Form Builder & Lead Generation Plugin is a versatile tool for creating customizable contact forms. It optimizes lead generation, streamlines communication, and enhances user engagement."

★★★★✩ (5) Active Installs: 10000+ Tested with: 6.2.3 PHP Version: false
Included Shortcodes:
  • [lead-form]

Lead Form Builder [lead-form] Shortcode

The Lead Form Builder shortcode is a vital tool for form generation. It allows you to create and display a lead form with a specified ID and title. The shortcode uses the function ‘lfb_lead_form_shortcode’, which outputs the form based on the given attributes. The form ID and title can be customized, providing flexibility in form creation and placement.

Shortcode: [lead-form]

Parameters

Here is a list of all possible lead-form shortcode parameters and attributes:

  • form-id – Identifies the specific form to display
  • title – Sets the title of the lead form

Examples and Usage

Basic example – A shortcode to display a lead form with a specified ID.

[lead-form form-id=1 /]

Advanced examples

Displaying a lead form by referencing both form-id and title. The form will first try to load by ID, but if not found, it will try to load by title.

[lead-form form-id=2 title='Contact Form' /]

Displaying a lead form by only referencing the title. In this case, the form will try to load by title.

[lead-form title='Registration Form' /]

PHP Function Code

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

Shortcode line:

add_shortcode('lead-form', 'lfb_lead_form_shortcode');

Shortcode PHP function:

function lfb_lead_form_shortcode($atts) {
    $output = '';
    $pull_quote_atts = shortcode_atts(array(
        'form-id' => 1,
        'title' => esc_html__('Lead Form','lead-form-builder'),
            ), $atts);
    $this_form_id = wp_kses_post($pull_quote_atts['form-id']);
    $th_front_end_froms = new LFB_Front_end_FORMS();
    $output = $th_front_end_froms->lfb_show_front_end_forms($this_form_id);
    return $output;
}

Code file location:

lead-form-builder/lead-form-builder/inc/lf-shortcode.php

Conclusion

Now that you’ve learned how to embed the Lead Form Builder Plugin shortcode, 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 *