CRED is a WordPress plugin that lets you easily build front-end forms for creating and editing content and users.
CRED User Guides include detailed documentation on creating forms, including related fields that belong to the content or the users, validating the input and displaying the forms with custom HTML styling.
When you ask for help or report issues, make sure to tell us the versions of the Toolset plugins that you have installed and activated.
Viewing 15 topics - 6,301 through 6,315 (of 6,328 total)
Problem: I would like to use a PHP variable in a shortcode attribute.
Solution: You can't use PHP variables directly in your shortcode attributes. Instead, you could create a custom shortcode that returns the value of that variable, and place that shortcode instead of the variable in your attribute.
$working_memap_id = 'some-post-slug';
add_shortcode( 'global_memap_id', 'global_memap_id_func');
function global_memap_id_func($atts)
{
global $working_memap_id;
return $working_memap_id;
}
[cred form form="properformname" post="[global_memap_id]"]
Register the name of the shortcode in Toolset > Settings > Frontend content > 3rd party shortcode arguments.
Problem: I have a CRED email notification set up that is sent out, but the message is incomplete. Some of the text that should be displayed in the middle of the notification does not appear, but other content beneath it does appear.
Solution: Ensure the syntax used to display your content is exactly right. An unterminated types field like this will cause a gap in your message, or a truncated message, depending on the content displayed after the field:
Problem: I have a CRED form that creates child posts. I would like to have the parent post be automatically assigned as the current post where the CRED form is displayed. I would also like a custom field value to be automatically the current User's name.
Solution:
There are two ways you can predefine a CRED form field value. You can use the "value" attribute, or you can use the "urlparam" attribute. The value attribute allows you to pass a value in using another shortcode, and the urlparam attribute allows you to capture a URL parameter variable and use that as the value.
You can use the wpv-user shortcode and the value attribute to predefine the user's name:
If you want to use the current post ID as the value of the parent field, you can use the wpv-post-id shortcode and the $current_page operator:
[cred_field field='_wpcf_belongs_parentslug_id' value='[wpv-post-id id='$current_page']' select_text='--- not set ---' class='form-control' output='bootstrap']
Pro tip: if you want to hide the predefined parent select field you can wrap it in a hidden div:
<div style="display:none;">
[cred_field field='_wpcf_belongs_parentslug_id' value='[wpv-post-id id='$current_page']' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>
Problem: I have a text search form on my View, and I would like to display a message in the results area until the User submits a search term. If no results are found after searching, I would like to display a different message. If results are found, I would like to display the results.
Solution: Use the wpv_filter_query_post_process filter to suppress results until the wpv_post_search parameter is supplied.
In your View's Loop Output editor, create your results design inside the wpv-loop tags. In the "no results found" area, use conditional HTML and your new wpv-post-param shortcode to determine if the wpv_post_search parameter exists, and display different messages.