culturaI
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 |
---|---|---|---|---|---|
Display parent post type in parametric search of child custom field
Started by: culturaI
in: Toolset Professional Support
Problem: In my website, there is parent post type "contatti" + child post type "corsi". I'm trying to setup a view that allow to display "contatti" that attended to "corsi" >= "data inizio corso" Solution: You can try this: 1) Create a view list child "corsi" posts, filter by custom field "data inizio corso": 2) In the view loop, display it's parent "contatti" post information: Relevant Documentation: https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/ |
|
2 | 8 | 6 years, 7 months ago | |
Update types custom field in parent post from custom field in child post
Started by: culturaI
in: Toolset Professional Support
Problem: I have: I would like that when filled "data-inizio-corso" the value is copied in "data-ultimo-corso" updating or creating the post. Solution: Types plugin is using a custom field "_wpcf_belongs_[parent-slug]_id" to store the parent post ID, for example, if the parent post type is using slug "contatto", then in single child "corso" post, there is a hidden field "_wpcf_belongs_contatto_id", the filed value is parent post ID, so if "$post_ID" is a child "corso" post ID, you can get the parent "contatto" post ID with PHP codes: $contatto_id = get_post_meta($post_ID, '_wpcf_belongs_contatto_id', true); Then use the $contatto_id to update the custom field "data-ultimo-corso" to what you want. Relevant Documentation: |
|
2 | 4 | 6 years, 7 months ago | |
Clarification on Repeating Fields Groups
Started by: culturaI
in: Types Community Support
Problem: In my site i have custom post type contacts, every contact can attend to 1 or more courses (usually 1 to 5). We'll plan to have 10.000-30.000 contacts. Instinctively i was thinking to use method of advanced custom field and add repeater fields (course type, level, date, ecc...) I read also some post on this forum, and some article from toolset documentation on group fields (many to many relationship or one to many) I'm a little confused on options and my question is: Solution: It depends on your settings. I assume we are talking about this case: Relevant Documentation: https://toolset.com/documentation/user-guides/many-to-many-post-relationship/ |
|
2 | 10 | 6 years, 7 months ago | |
Filter custom post by
Started by: culturaI
in: Types Community Support
Problem: I would like to create a custom search filter that lets me filter posts by "age", calculated from a date in a custom field. I would like to be able to select an age range in my custom search View. If I must filter by date range instead, I would like to show more than just 20 years in the datepicker's "year" select field. Solution: Views can let you set up a custom search filter between two values, but those values must be custom field values or the post date. They cannot be values calculated on-the-fly. "Age" is not a custom field value - it depends on a calculation using the current date. So there is not a good way to set that up in the Views GUI. I can help you set up filters between two custom field dates, but not between two ages. That would require a significant amount of custom code that falls outside the scope of the support we provide here in the forums. If you are comfortable writing your own code, you can use the wpv_filter_query API filter to apply a postmeta value range based on your own custom inputs. You could access the custom input values in PHP in the $_GET superglobal, and use those to calculate a start and end timestamp. Then you could apply those criteria to a meta query on your birthdate field. If you want to filter by date range using datepickers, you can control the year range using the standard jQuery UI option "yearRange": jQuery(document).ready(function(){ jQuery('input.hasDatepicker').datepicker('option',{'yearRange':'1990:2040'}); }); Relevant Documentation: |
|
2 | 5 | 6 years, 7 months ago | |
Create a “mailto” link with repeating custom field values
Started by: culturaI
in: Types Community Support
Problem: I have a custom search View that shows a table of posts with filters. These posts include a repeating custom field where multiple email addresses can be stored. I would like to create a single link on the site that I can click to open a new email in Outlook, with all email addresses from these filtered posts used as recipients of the new email. Solution: <a href="mailto:email1@gmail.com,email2@gmail.com,email3@gmail.com">Your link text</a> Step 1. Create a new View that is a duplicate of the custom search View. In the Loop Output editor, replace the output with the code below: [wpv-layout-start][wpv-items-found]<!-- wpv-loop-start --><wpv-loop>[types field='email-field-slug' separator=',' output='raw'][/types],</wpv-loop><!-- wpv-loop-end -->[/wpv-items-found][wpv-no-items-found][/wpv-no-items-found][wpv-layout-end] Place this View somewhere on the same page as your custom search View. You should see a list of email addresses, separated by a comma. There may be some empty spaces, but that's okay. Step 2. Set up a text filter that removes all the empty spaces and extra markup from the output. In your child theme's functions.php file, add this code: function prefix_clean_view_output( $out, $id ) { $ids = array( 12345 ); if ( in_array( $id, $ids )) { $start = strpos( $out, '<!-- wpv-loop-start -->' ); if ( $start !== false && strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false ) { $start = $start + strlen( '<!-- wpv-loop-start -->' ); $out = substr( $out , $start ); $end = strrpos( $out, '<!-- wpv-loop-end -->' ); $out = substr( $out, 0, $end ); } else { $start = strpos( $out, '>' ); if ( $start !== false) { $out = substr( $out, $start + 1 ); $end = strpos( $out, '<' ); $out = trim(substr( $out, 0, $end )); } } } return $out; } add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 ); Replace 12345 with the numeric ID of your new View. Now when you look at the results of this View you should not see the extra spaces or markup. Step 3. Use the results of this View to create a mailto link: <a href="mailto:[wpv-view name='your-new-view-slug']">Send an email</a> Replace your-new-view-slug with the slug of your new View. Now replace the new View shortcode on your site with the link code above. Relevant Documentation: https://toolset.com/documentation/user-guides/digging-into-view-outputs/ |
|
2 | 13 | 6 years, 7 months ago | |
Auto assign many-to-many relationship to a parent
Started by: culturaI
in: Types Community Support
Problem: I have a CRED form that allows users to create child posts. I would like to predefine the parent post so the User does not need to select it. Solution: If you want to predefine values for a CRED field, you have 3 basic options: 1. Provide the value as a URL parameter. Link to the page containing the CRED form using the URL value to supply the correct parent ID, something like yoursite.com/cred-form-page?contatti=1234. Then update your parent contatti CRED field and add the urlparam attribute: [cred_field field='_wpcf_belongs_contatti_id' post="iscrizioni" urlparam="contatti"] This would predefine the contatti with ID 1234 as the parent of the new post. 2. Provide the value in the value attribute. You can use a hard-coded number or a shortcode in the value attribute to predefine the parent contatti ID: [cred_field field='_wpcf_belongs_contatti_id' post="iscrizioni" value="1234"] 3. Write your own custom code with JavaScript and/or PHP. Note that there is no CRED JavaScript API, so the amount of support we can provide for custom JavaScript is fairly limited. In all 3 cases, you can wrap the field in a hidden div if you want to hide the field from your Users: <div style="display:none;"> [cred_field ...] </div> Relevant Documentation: |
|
2 | 6 | 6 years, 7 months ago | |
Display custom post name like custom field1 + custom field2
Started by: culturaI in: Types Community Support |
1 | 2 | 6 years, 8 months ago | ||
Custom search duplicate
Started by: culturaI in: Types Community Support |
|
2 | 3 | 6 years, 8 months ago |