Below, you’ll find a detailed guide on how to add the Frontend Post Submission Manager Lite 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 Frontend Post Submission Manager Lite Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Frontend Post Submission Manager Lite Plugin and the shortcodes it provides:
"Frontend Posting WordPress Plugin – Frontend Post Submission Manager Lite is a user-friendly tool that enables seamless post submissions directly from your site's frontend. Ideal for community-driven platforms."
- [fpsm]
Frontend Post Submission Manager Lite [fpsm] Shortcode
The Frontend Post Submission Manager Lite shortcode, ‘fpsm’, dynamically generates a form based on the given alias. This shortcode retrieves a form’s details using the alias provided in the shortcode attributes. If a form with the specified alias exists, it registers frontend assets, sets global variables, and outputs the form’s HTML. If the form doesn’t exist, it returns an error message.
Shortcode: [fpsm]
Parameters
Here is a list of all possible fpsm shortcode parameters and attributes:
alias
– the unique name for identifying the specific form
Examples and Usage
Basic example – Display a form using its alias
[fpsm alias="contact_form"]
This shortcode will display the form that has the alias “contact_form”. If the form with this alias does not exist, it will display a message stating “Form not available for this alias.”
Advanced examples
Display a form using its alias and add additional parameters
[fpsm alias="contact_form" param1="value1" param2="value2"]
In this advanced example, we’re using the same basic shortcode to display a form with the alias “contact_form”. However, we’re also adding two additional parameters, “param1” and “param2”, and assigning them the values “value1” and “value2” respectively. This can be useful for further customizing the output of the form based on these parameters. Please note that these parameters are just placeholders, and you would need to replace them with actual parameters supported by the plugin.
PHP Function Code
In case you have difficulties debugging what causing issues with [fpsm]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('fpsm', array($this, 'output_form_shortcode'));
Shortcode PHP function:
function output_form_shortcode($atts) {
if (!empty($atts['alias'])) {
global $fpsml_library_obj;
$alias = $atts['alias'];
$form_row = $fpsml_library_obj->get_form_row_by_alias($alias);
if (!empty($form_row)) {
$form_details = maybe_unserialize($form_row->form_details);
$this->register_frontend_assets();
$GLOBALS['fpsml_form_details'] = $form_details;
$GLOBALS['fpsml_form_alias'] = $alias;
ob_start();
include(FPSML_PATH . '/includes/views/frontend/form-shortcode.php');
$form_html = ob_get_contents();
ob_end_clean();
return $form_html;
} else {
return esc_html__('Form not available for this alias.', 'frontend-post-submission-manager-lite');
}
}
}
Code file location:
frontend-post-submission-manager-lite/frontend-post-submission-manager-lite/includes/classes/class-fpsml-shortcode.php
Conclusion
Now that you’ve learned how to embed the Frontend Post Submission Manager Lite 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