th
Support threads created in the last 30 days: 0
Favorite Forum Topics
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Automatically Copy Images in Different Languages Types + WPML no longer working
Started by: th in: Toolset Professional Support |
2 | 4 | 6 years, 7 months ago | ||
Automatically Copy Images in Different Languages Types + WPML
Started by: th
in: Toolset Professional Support
Problem: I would like to synchronize changes to image custom fields and featured images made in CRED across all translations. Solution: Add the following code to sync these fields: add_action('cred_save_data', 'ts_sync_fields_and_featured_img',10,2); function ts_sync_fields_and_featured_img($post_id, $form_data) { // if a specific form if ($form_data['id']==12345) { $post_type_slug = 'book'; do_action( 'wpml_sync_all_custom_fields', $post_id ); $languages = apply_filters( 'wpml_active_languages', NULL, 'orderby=id&order=desc' ); if ( !empty( $languages ) ) { foreach( $languages as $l ) { $translated_id = apply_filters( 'wpml_object_id', $post_id, $post_type_slug, true, $l['language_code'] ); $post_thumbnail_id = get_post_thumbnail_id( $post_id ); set_post_thumbnail( $translated_id, $post_thumbnail_id ); } } } } Relevant Documentation: |
2 | 7 | 6 years, 8 months ago |
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Query Filter by Featured Image
Started by: th
in: Toolset Professional Support
Problem: I would like to add a Query Filter that checks whether or not a post has a featured image. Solution: WordPress stores the featured image in the postmeta table under the key "_thumbnail_id". Using the Views API wpv_filter_query, you could add a check for that meta key to the meta query already generated by the Query Filters. Here's a snippet you can add to functions.php: [php]add_filter( 'wpv_filter_query', 'add_filter_by_thumbnail', 10, 3 ); function add_filter_by_thumbnail ( $query, $view_settings, $view_id ) { if( $view_id == 12345 ) { $args = array( 'relation' => 'AND', array( 'key' => '_thumbnail_id', 'compare' => 'EXISTS' ) ); // add these arguments to your meta query $query['meta_query'] = isset($query['meta_query']) ? $query['meta_query'] : []; $query['meta_query'][] = $args; } return $query; } Replace 12345 with the numeric ID of this View, and you should find that the results of the View all have featured images defined. Relevant Documentation: |
3 | 7 | 5 years, 1 month ago | ||
Default Value In the Search Query
Started by: th
in: Toolset Professional Support
Problem: Solution: For example: <label>[wpml-string context="wpv-views" class="bfm-label" ]Gender[/wpml-string]</label> [wpv-control-postmeta field="wpcf-gender" type="select" default_label="Select Gender" url_param="wpv-wpcf-gender"]</div></div> Relevant Documentation: |
2 | 5 | 6 years, 2 months ago | ||
Prevent p tag in WYSIWYG editor
Started by: th in: Toolset Professional Support |
2 | 4 | 6 years, 4 months ago | ||
Automatically Copy Images in Different Languages Types + WPML no longer working
Started by: th in: Toolset Professional Support |
2 | 4 | 6 years, 7 months ago | ||
CRED Frontend Submission Taking Forever
Started by: th in: Toolset Professional Support |
3 | 9 | 6 years, 7 months ago | ||
Setting Up Custom Post Type Frontend Submission
Started by: th
in: Toolset Professional Support
Problem: Solution: You can find proposed solution, in this case, with the following reply: Relevant Documentation: |
2 | 3 | 6 years, 8 months ago | ||
Automatically Copy Images in Different Languages Types + WPML
Started by: th
in: Toolset Professional Support
Problem: I would like to synchronize changes to image custom fields and featured images made in CRED across all translations. Solution: Add the following code to sync these fields: add_action('cred_save_data', 'ts_sync_fields_and_featured_img',10,2); function ts_sync_fields_and_featured_img($post_id, $form_data) { // if a specific form if ($form_data['id']==12345) { $post_type_slug = 'book'; do_action( 'wpml_sync_all_custom_fields', $post_id ); $languages = apply_filters( 'wpml_active_languages', NULL, 'orderby=id&order=desc' ); if ( !empty( $languages ) ) { foreach( $languages as $l ) { $translated_id = apply_filters( 'wpml_object_id', $post_id, $post_type_slug, true, $l['language_code'] ); $post_thumbnail_id = get_post_thumbnail_id( $post_id ); set_post_thumbnail( $translated_id, $post_thumbnail_id ); } } } } Relevant Documentation: |
2 | 7 | 6 years, 8 months ago |