olliM-3
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Get related parent post custom field in child post using meta key
Started by: olliM-3 in: Toolset Professional Support |
1 | 2 | 5 years, 3 months ago | ||
Count the sum of numeric custom fields from custom post types
Started by: olliM-3 in: Toolset Professional Support |
2 | 2 | 5 years, 8 months ago | ||
Assign category to new post, based on author user fields
Started by: olliM-3
in: Toolset Professional Support
Problem: I have a Form that allows Users to submit posts. I would like to automatically assign different taxonomy terms to each post based on custom fields in the author's User profile. Solution: Use the cred_save_data hook to add terms to a post created by Forms. Create a custom field on the User profile that can be used in the cred_save_data callback to determine which terms should be added to the post. add_action('cred_save_data', 'set_blog_terms',100,2); function set_blog_terms($post_id, $form_data) { global $current_user; $forms = array( 9544 ); if (in_array($form_data['id'], $forms)) { $array = array( 'malawi-2018' => array('blogi','kapua-2018-malawi'), 'oma-kapua-nepal-2018' => array('blogi','oma-kapua-2018-nepal'), ); $taxonomy = 'category'; $userFieldValue = get_user_meta( $current_user->ID, 'wpcf-kapuaja-hanke', true); if(!$userFieldValue) { return; } $tag = $array[$userFieldValue]; wp_set_object_terms( $post_id, $tag, $taxonomy, true ); } } Relevant Documentation: |
2 | 9 | 6 years, 3 months ago | ||
Default content template for custom posts submitted with CRED form
Started by: olliM-3
in: Toolset Professional Support
Problem: Solution: To assign the content template to posts created using the CRED form, please add following generic hidden field to your CRED form before the submit button and save the form and try to create a new post . For example: [cred_generic_field field='_views_template' type='hidden' class='' urlparam=''] { "required":0, "persist":1, "validate_format":0, "default":"99999" } [/cred_generic_field] Where: You can find proposed solution, in this case, with the following reply: Relevant Documentation: |
2 | 3 | 6 years, 5 months ago |