Using the Shortcode [bfsinglefield]

By using this shortcode the user can display the submitted values in a form field anywhere on the website, either by including it directly in the templates or using it within the Wordpress block editor. Next we will show the process for both cases.

1. Including the shortcode inside a template

Let's say we want to automatically include the information submitted in a field in every post that is created in a form. For them we must go to the template (in this case single.php) and make use of the function do_shortcode(). For the shortcode to work correctly, the slug of the form and the slug of the field to be displayed must be entered as attributes.

Thus, we are going to show the content of the field of type Textarea after the content of the post. The shortcode to use in our case would be:

[bfsinglefield form-slug="post-simple" field-slug="my_field_slug"]

And the line of code would look like:

echo do_shortcode( '[bfsinglefield form-slug="post-simple" field-slug="my_field_slug"]' );

Once these changes have been made we can fill out our test form with the following data:

Once the form is submitted, when we see the post in the frontend we have the following:


2. Using the WordPress block editor

Within the Wordpress block editor it is very easy to use this shortcode, we just have to add a new block in the place we want and select Shortcode:

A new text input will be displayed in which we can enter the shortcode created previously:

We can now do a quick test by filling the form with the following information:

And when we see the post in the frontend we have:

Still need help? Contact Us Contact Us