chantellel
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 |
---|---|---|---|---|---|
Conditional Display of Search Filters
Started by: chantellel
in: Toolset Professional Support
Problem: I have a custom search View with multiple filters. I am trying to show and hide some filters using CRED conditional groups, but it's not working. Solution: CRED (or Forms) conditional groups cannot be used in a View's search filters. They can only be used in Forms. At this time there is not an easy way to show and hide some filters based on the selections in other filters. Views has a feature called "Limiting Filter Inputs According to Available Results". When this configuration is chosen, the filters will respond intelligently each time a new filter is selected, so that only the filter options that would produce results are enabled. Unfortunately it is not as customizable as conditional HTML. Relevant Documentation: |
2 | 2 | 6 years, 6 months ago | ||
Page views counter with User custom field
Started by: chantellel
in: Toolset Professional Support
Problem: I would like to create a custom Page View counting system that increments a custom field in a User's profile when someone visits their content. Solution: I can show you how to save some value in a User profile custom field using PHP, and how to retrieve that value from a User profile custom field using PHP. $meta = get_user_meta( $post->ID, 'wcpf-count', TRUE ); Is $post->ID accurate here? I think not. You need an author's User ID, not a post ID. Example: $meta = get_user_meta( 12345, 'wcpf-count', TRUE ); The variable $meta will contain the value of the wpcf-count field in the profile of User ID 12345. Replace 12345 with the correct User ID, or a variable representing the correct User ID. Try hard-coding a value first, then replace that with a variable and test again. Your code: update_user_meta( $authordata->ID, wcpf-count', implode(',', $meta) ); You have a syntax error here. The second parameter, wpcf-count, is not correctly surrounded by quotes. Example: [php] update_user_meta( 12345, 'wcpf-count', 'some value' ); Replace 12345 with the correct author's ID, and replace 'some-value' with the correct value to store in the custom field. Try hard-coding the values first, then once things work as expected replace the hard-coded values with variables. How you trigger this code is up to you. That part of the application falls outside the scope of support we provide here in the forums. Relevant Documentation: |
2 | 4 | 6 years, 10 months ago | ||
Get data from Custom Fields and update other posts with it
Started by: chantellel
in: Toolset Professional Support
Problem: Solution: |
2 | 6 | 6 years, 11 months ago | ||
Rewrite permalinks for two post types
Started by: chantellel
in: Toolset Professional Support
Problem: The issue here is that the user's custom permalink structure was not working for one of his CPT. The user's code was add_filter( 'post_type_link', 'my_post_type_link2', 98, 2 ); function my_post_type_link2( $post_link, $post = null ) { if ( !empty($post) ) { $post_type = get_post_type($post->ID); if($post_type == "projects") { return str_replace('%post_id%', $post->ID, $post_link); } else { return str_replace('%post_id%', '', $post_link); } } } add_filter( 'post_type_link', 'type_link', 99, 2 ); function type_link( $post_link, $post = null ) { if ( !empty($post) ) { $post_type = get_post_type($post->ID); if($post_type == "projects1") { return str_replace('%post_id%', $post->ID, $post_link); } else { return str_replace('%post_id%', '', $post_link); } } } Solution: add_filter( 'post_type_link', 'my_post_type_link2', 99, 2 ); function my_post_type_link2( $post_link, $post = null ) { if ( !empty($post) ) { $post_type = get_post_type($post->ID); if($post_type == "projects" || $post_type == "projects1") { return str_replace('%post_id%', $post->ID, $post_link); } else { return str_replace('%post_id%', '', $post_link); } } } Since the functions are exactly the same. Now just ensure that the $post_type slug is exactly the same as the one you had created in types. |
2 | 6 | 6 years, 11 months ago | ||
Delete users posts when Woocommerce subscription cancels
Started by: chantellel in: Toolset Professional Support |
2 | 15 | 6 years, 11 months ago | ||
Subscriptions multiple role changes
Started by: chantellel in: Toolset Professional Support |
2 | 4 | 6 years, 11 months ago | ||
Adding a secondary role to a wordpress user
Started by: chantellel in: Toolset Professional Support |
2 | 4 | 6 years, 11 months ago |