|
|
Save/Update the featured image title with the post title
Started by: Fred Konings
in: Toolset Professional Support
Quick solution available
Problem:
How to set the uploaded image title in the form same as the created post title.
Solution:
Add the custom code below:
function update_featured_image_title_foto( $post_id, $form_data ) {
// Check form being used, else do nothing
if ( $form_data[ 'id' ] == 485 ) {
// get post title
$custom_image_title = esc_html( get_the_title($post_id) );
// get featured image ID
$featured_image_id = get_post_thumbnail_id($post_id);
// update post_title
$updated_image_data = array(
'ID' => $featured_image_id,
'post_title' => $custom_image_title,
);
// Update the field(s)
wp_update_post($updated_image_data);
}
}
add_action( 'cred_save_data', 'update_featured_image_title_foto', 15, 2 );
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/
|
|
2 |
7 |
3 years, 12 months ago
Fred Konings
|
|
|
YouTube block problem in content template
Started by: chelhwanS
in: Toolset Professional Support
Quick solution available
Problem:
YouTube Block does not show correctly in the view.
Solution:
The name of the custom post type is created in a non Latin language and that was the issue.
- Changed the language to English.
- Added/edited the view.
- Added a few correct URLs for the videos in posts.
- It showed in the front end.
- Turned back to Korean and it still works.
|
|
2 |
11 |
3 years, 12 months ago
Christopher Amirian
|