Display Posts
Most of the themes or plugins come with their own views to display submissions. If you use BuddyForms to create a form for an existing post type, the display part is most of the time already done because the theme or plugin is creating the post type. In this case, you only use BuddyForms for the frontend form and management of the user's submissions from the frontend.
If you have created your own post type and search for a way to list the post created by a form you can use the following Shortcodes.
Display Submission
[buddyforms_list_all form_slug="" query_option="list_all_published_posts" user_logged_in_only="false"]
Options:
- form_slug --> is required
- This is the string to identify the Forms.
- query_option --> is optional
- Define how to get the submissions.
- Possibles values for this shortcode
- list_all_published_post
- List all published post
- list_all_published_posts_by_meta_key
- List all entries matching the `meta_key` and `meta_value` option
- empty
- If you leave empty they will show all entries submitted with the current from the `form_slug` option
- list_all_published_post
- user_logged_in_only --> is optional | values: true/false/logged_in_only
- Define if the shortcode output will be available for logged in users or public users
- post_type --> is optional
- Post type to list by the shortcode, by default use the value set up in the setting of the form defined in the `form_slug`
- meta_value --> is optional
- Use with `meta_key`, this option is the value you against you want to verify the `meta_key`
- This option is only available if the query_option is `list_all_published_posts_by_meta_key`
- meta_key --> is optional
- Use with `meta_value`, this option is the key you need to search to compare with the `meta_value`
- This option is only available if the query_option is `list_all_published_posts_by_meta_key`
- list_posts_style --> is optional | values: list/table
- Define the style of the output.
Examples
Get the Post for not logged in users comparing by post_meta
[buddyforms_list_all form_slug="post-excerpt-amount-of-row" query_option="list_all_published_posts_by_meta_key" meta_key="number" meta_value="4" user_logged_in_only="false"]
Get all published post from the Form `post-excerpt-amount-of-row` only for logged in users
[buddyforms_list_all query_option="list_all_published_posts" form_slug="post-excerpt-amount-of-row" user_logged_in_only="true" post_type="post"]
Get the list of Post from multiples Forms
[buddyforms_list_all query_option="list_all_published_posts_by_meta_key" meta_value="test-bf-geo-my-wp,test-excerpt" meta_compare="in" form_slug="test-bf-geo-my-wp" meta_key="_bf_form_slug"]
Important: Notice the form_slug is present and the value is repeated in the meta_value, is because in this case is override by the meta comparison, but the form_slug need to be present to make this work.