Below, you’ll find a detailed guide on how to add the WPB Popup for Contact Form 7 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 WPB Popup for Contact Form 7 Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the WPB Popup for Contact Form 7 Plugin and the shortcodes it provides:
"WPB Popup for Contact Form 7 is a handy plugin that enables the display of Contact Form 7 as a popup on button click, enhancing user interaction and experience."
- [wpb-pcf-button]
WPB Popup for Contact Form 7 [wpb-pcf-button] Shortcode
The wpb-popup-for-contact-form-7 shortcode is a tool that triggers a popup contact form when a button is clicked. This shortcode utilizes the ‘contact_form_button_shortcode’ function, which appends the popup form to the button. It captures and returns the generated HTML content, effectively creating a seamless user interaction.
Shortcode: [wpb-pcf-button]
Examples and Usage
Basic example – The following shortcode is used to display a button that triggers a popup contact form when clicked. It uses the ID of the contact form as a parameter.
[wpb-pcf-button id="123" /]
Advanced examples
In this example, the shortcode is used to display a button with a custom label that triggers a popup contact form. It uses the ID of the contact form and a custom label as parameters.
[wpb-pcf-button id="123" label="Contact Us Now" /]
In the next example, the shortcode is used to display a button with a custom label and custom CSS classes that triggers a popup contact form. It uses the ID of the contact form, a custom label, and custom CSS classes as parameters.
[wpb-pcf-button id="123" label="Contact Us Now" class="my-custom-class another-custom-class" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [wpb-pcf-button]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'wpb-pcf-button', array( $this, 'contact_form_button_shortcode' ) );
Shortcode PHP function:
function contact_form_button_shortcode( $atts, $content = '' ) {
ob_start();
wpb_pcf_contact_form_button( $atts );
$content .= ob_get_clean();
return $content;
}
Code file location:
wpb-popup-for-contact-form-7/wpb-popup-for-contact-form-7/includes/class.shortcode.php
Conclusion
Now that you’ve learned how to embed the WPB Popup for Contact Form 7 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.
Leave a Reply