Thumbnail not showing up
-
Hello, thank you for great plugin, saved my life. But now problem is persisting on particular issue.
The form consists of may inputs, and all work except file/image/thumbnail.
Code in CF7 is:
Your Image: [file image limit:1048576 filetypes:jpg|jpeg|png|gif]
And code in functions.php is (I got rid of unnecessary lines of code for showing here):
add_action( 'cf7_2_post_save_form', 'a_new_post',10,3); function a_new_post($cf7_key, $submitted_data, $submitted_files){ $thumbnail = $submitted_data['image']; //first insert/update your new post. //for the current user if someone is logged in. $post_args = array( 'the_post_thumbnail' => $thumbnail ); //check if this is an existing post (draft) being saved/submitted if(isset($submitted_data['map_post_id'])){ $post_id = $submitted_data['map_post_id']; $post_args['ID']=$post_id; wp_udpate_post($post_args); }else{ $post_id = wp_insert_post($post_args); } //update the meta-field update_post_meta($post_id, 'the_post_thumbnail', $thumbnail); }
Do you have any idea what am I doing wrong?
Thanks,
Alex
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Thumbnail not showing up’ is closed to new replies.