本文整理汇总了PHP中set_post_thumbnail函数的典型用法代码示例。如果您正苦于以下问题:PHP set_post_thumbnail函数的具体用法?PHP set_post_thumbnail怎么用?PHP set_post_thumbnail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_post_thumbnail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: media_sideload_image_1
function media_sideload_image_1($file, $post_id, $desc = null, $return = 'html')
{
if (!empty($file)) {
// Set variables for storage, fix file filename for query strings.
preg_match('/[^\\?]+\\.(jpe?g|jpe|gif|png)\\b/i', $file, $matches);
$file_array = array();
$file_array['name'] = basename($matches[0]);
// Download file to temp location.
$file_array['tmp_name'] = download_url($file);
// If error storing temporarily, return the error.
if (is_wp_error($file_array['tmp_name'])) {
return $file_array['tmp_name'];
}
// Do the validation and storage stuff.
$id = media_handle_sideload($file_array, $post_id, $desc);
// If error storing permanently, unlink.
if (is_wp_error($id)) {
@unlink($file_array['tmp_name']);
return $id;
}
/*$fullsize_path = get_attached_file( $id ); // Full path
if (function_exists('ewww_image_optimizer')) {
ewww_image_optimizer($fullsize_path, $gallery_type = 4, $converted = false, $new = true, $fullsize = true);
}*/
$src = wp_get_attachment_url($id);
}
if (!empty($src)) {
//update_post_meta($post_id, 'image_value', $src);
set_post_thumbnail($post_id, $id);
//update_post_meta($post_id, 'Thumbnail', $src);
return get_post_meta($post_id, 'image_value', true);
} else {
return new WP_Error('image_sideload_failed');
}
}
示例2: import_attachment_by_articles
function import_attachment_by_articles()
{
wp_reset_postdata();
query_posts(array('post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'DESC', 'posts_per_page' => '-1'));
if (have_posts()) {
$i = 1;
while (have_posts()) {
the_post();
$post_meta = get_post_meta(get_the_ID());
if (!empty($post_meta['headerImages'])) {
$post_meta_headerImages = unserialize($post_meta['headerImages'][0]);
foreach ($post_meta_headerImages as $key => $header_images) {
$metaPostID = $media_item = null;
echo get_the_ID() . "--" . $header_images . "--";
$metaPostID = get_post_id_by_meta_key_and_value('post_id', get_the_ID());
$media_item = get_permalink($metaPostID);
if (!empty($metaPostID) && !empty($media_item)) {
echo "{$metaPostID} available <br>";
set_post_thumbnail(get_the_ID(), $metaPostID);
update_post_meta(get_the_ID(), 'post_promo-image_thumbnail_id', $metaPostID);
continue;
} else {
//print_r($metaPostID);
echo " {$metaPostID} not attachment {$media_item} <br>";
}
$attachment_id = null;
if ($key == "header" || $key == "promoSmall" || $key == "homepage") {
add_image_size('promo-small', 288, 9999);
} elseif ($key == "promoLarge" || $key == 'imagegroup') {
add_image_size('promo-large', 650, 317);
add_image_size('promo-small', 288, 9999);
}
$filename = get_attachment_details_from_table($key, get_the_ID(), $header_images);
if (empty($filename)) {
$filename = $header_images . '-' . $key . '.jpg';
}
$url = "http://image.adam.automotive.com/f/{$header_images}/{$filename}";
$attachment_id = download_attachment($url, $filename, get_the_ID());
if (!empty($attachment_id)) {
update_post_meta($attachment_id, 'post_id', get_the_ID());
update_post_meta($attachment_id, 'imageType', $key);
//if($key=="header"){
set_post_thumbnail(get_the_ID(), $attachment_id);
update_post_meta(get_the_ID(), 'post_promo-image_thumbnail_id', $attachment_id);
//}
echo "Success";
} else {
echo "Fail";
}
echo "<br>";
}
}
// echo "<pre>";
// print_r($post_meta['headerImages']);
// echo "</pre>";
// echo "<br>";
}
wp_reset_postdata();
}
}
示例3: process_submit_new
public function process_submit_new()
{
if (!wp_verify_nonce($_POST['hackgov_submit_new'], 'hackgov_submit_new_nonce')) {
wp_die('not auth');
}
$defaults = array('featured_image' => '', 'title' => '', 'problem' => '', 'recommendation' => '', 'priority' => '', 'category' => '', 'latitude' => '', 'longitude' => '', 'location_address' => '');
$data = (object) wp_parse_args($_POST, $defaults);
// Create post object
$new_post = array('post_title' => $data->title, 'post_content' => $data->problem, 'post_status' => 'pending', 'post_author' => get_current_user_id());
global $hackgov_messages;
if (empty($hackgov_messages)) {
$hackgov_messages = array();
}
// Insert the post into the database
$post_id = wp_insert_post($new_post);
if ($post_id) {
// set the post thumbnail
if (!empty($data->featured_image)) {
set_post_thumbnail($post_id, $data->featured_image);
}
// set meta type
update_post_meta($post_id, '_post_recommendation', $data->recommendation);
update_post_meta($post_id, '_category_priority', $data->priority);
update_post_meta($post_id, '_category_category', $data->category);
update_post_meta($post_id, '_latitude', $data->latitude);
update_post_meta($post_id, '_longitude', $data->longitude);
update_post_meta($post_id, '_location', $data->location_address);
do_action('hackgov_success_create_pending_post', $post_id, $data);
$hackgov_messages[] = array('type' => 'success', 'message' => __('Konten berhasil di kirim.', 'hackgov'));
} else {
do_action('hackgov_failed_create_pending_post');
$hackgov_messages[] = array('type' => 'error', 'message' => __('Konten gagal di kirim.', 'hackgov'));
}
}
示例4: save_images
function save_images($image_url, $post_id, $i)
{
//set_time_limit(180); //每个图片最长允许下载时间,秒
$file = file_get_contents($image_url);
$fileext = substr(strrchr($image_url, '.'), 1);
$fileext = strtolower($fileext);
if ($fileext == "" || strlen($fileext) > 4) {
$fileext = "jpg";
}
$savefiletype = array('jpg', 'gif', 'png', 'bmp');
if (!in_array($fileext, $savefiletype)) {
$fileext = "jpg";
}
$im_name = date('YmdHis', time()) . $i . mt_rand(10, 20) . '.' . $fileext;
$res = wp_upload_bits($im_name, '', $file);
if (isset($res['file'])) {
$attach_id = insert_attachment($res['file'], $post_id);
} else {
return;
}
if (ot_get_option('auto_save_image_thumb') == 'on' && $i == 1) {
set_post_thumbnail($post_id, $attach_id);
}
return $res;
}
示例5: __invoke
/**
* Loop through all posts, setting the first attached image as the featured images
*
* ## OPTIONS
*
* ## EXAMPLES
*
* wp auto-thumbnail
*
*/
public function __invoke($args, $assoc_args)
{
set_time_limit(0);
// Get all public post types
$get_post_types = get_post_types(array('public' => true));
// Post types array that will be used by default
$post_types = array();
foreach ($get_post_types as $post_type) {
// Only add post types that support
if (post_type_supports($post_type, 'thumbnail')) {
$post_types[] = $post_type;
}
}
// Default values for wp query
$defaults = array('post_type' => $post_types, 'posts_per_page' => -1, 'post_status' => 'any');
// Merge user args with defaults
$assoc_args = wp_parse_args($assoc_args, $defaults);
// The Query
$the_query = new WP_Query($assoc_args);
// Number of posts returned by query
$found_posts = $the_query->found_posts;
// Generate progess bar
$progress = new \cli\progress\Bar('Progress', $found_posts);
// Counter for number of post successfully processed
$counter_success = 0;
// Counter for number of post processed
$counter_processed = 0;
// The Loop
while ($the_query->have_posts()) {
$the_query->the_post();
// Move the processbar on
$progress->tick();
$has_thumb = has_post_thumbnail(get_the_ID());
if (!$has_thumb) {
$attached_image = get_children("post_parent=" . get_the_ID() . "&post_type=attachment&post_mime_type=image&numberposts=1");
if ($attached_image) {
foreach ($attached_image as $attachment_id => $attachment) {
set_post_thumbnail(get_the_ID(), $attachment_id);
$counter_success++;
}
}
$counter_processed++;
}
}
$progress->finish();
/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset.
*/
wp_reset_postdata();
if ($found_posts == 0) {
WP_CLI::error("No posts found");
} elseif ($counter_processed == 0) {
WP_CLI::error("No posts processed");
} elseif ($counter_success == 0) {
WP_CLI::success("Unable to processed any posts");
} else {
WP_CLI::success("Processing compelete. {$counter_success} of {$counter_processed} where processed successfully.");
}
}
示例6: setMediaData
static function setMediaData()
{
global $easy_metadata;
$attach_ids = get_option('easy_demo_images');
if (!$attach_ids) {
return;
}
$pattern = '(\\bhttps?:\\/\\/\\S+?\\.(?:jpg|png|gif))';
$fn_i = array();
foreach ($attach_ids as $key => $id) {
$fn_i[] = wp_get_attachment_image_src($id, 'full');
}
$image_metas = explode(',', $easy_metadata['data']->post_meta_replace);
$mi = count($image_metas);
$post_types = explode(',', $easy_metadata['data']->post_type);
$wp_query = new WP_Query(array("post_type" => $post_types, "posts_per_page" => -1));
while ($wp_query->have_posts()) {
$wp_query->the_post();
$id = get_the_ID();
set_post_thumbnail($id, $attach_ids[0]);
if ($easy_metadata['data']->force_image_replace == "yes") {
$content = get_the_content();
$content = preg_replace($pattern, addslashes($fn_i[0][0]), $content);
wp_update_post(array("ID" => $id, "post_content" => $content));
}
for ($i = 0; $i < $mi; $i++) {
update_post_meta($id, $image_metas[$i], $fn_i[0][0]);
}
}
}
示例7: ajax_add_thumbnail
/**
* ajax_add_thumbnail()
*
* Adds a thumbnail to user meta and returns thumbnail html
*
*/
public function ajax_add_thumbnail()
{
if (!current_user_can('upload_files')) {
die('');
}
$post_id = isset($_POST['post_id']) ? absint($_POST['post_id']) : 0;
$user_id = isset($_POST['user_id']) ? absint($_POST['user_id']) : 0;
$thumbnail_id = isset($_POST['thumbnail_id']) ? absint($_POST['thumbnail_id']) : 0;
if ($post_id == 0 || $user_id == 0 || $thumbnail_id == 0 || 'mt_pp' !== get_post_type($post_id)) {
die('');
}
check_ajax_referer("mt-update-post_{$post_id}");
//Save user meta
update_user_option($user_id, 'metronet_post_id', $post_id);
update_user_option($user_id, 'metronet_image_id', $thumbnail_id);
//Added via this thread (Props Solinx) - https://wordpress.org/support/topic/storing-image-id-directly-as-user-meta-data
set_post_thumbnail($post_id, $thumbnail_id);
if (has_post_thumbnail($post_id)) {
$thumb_src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'thumbnail', false, '');
$post_thumbnail = sprintf('<img src="%s" width="150" height="150" title="%s" />', esc_url($thumb_src[0]), esc_attr__("Upload or Change Profile Picture", 'metronet-profile-picture'));
$crop_html = $this->get_post_thumbnail_editor_link($post_id);
$thumb_html = sprintf('<a href="#" class="mpp_add_media">%s</a>', $post_thumbnail);
$thumb_html .= sprintf('<a id="metronet-remove" class="dashicons dashicons-trash" href="#" title="%s">%s</a>', esc_attr__('Remove profile image', 'metronet-profile-picture'), esc_html__("Remove profile image", "metronet-profile-picture"));
die(json_encode(array('thumb_html' => $thumb_html, 'crop_html' => $crop_html, 'has_thumb' => true)));
}
die(json_encode(array('thumb_html' => '', 'crop_html' => '', 'has_thumb' => false)));
}
示例8: smamo_sync_thumb
function smamo_sync_thumb($post_id)
{
$img_id = get_post_meta($post_id, 'img', true);
if (isset($img_id)) {
set_post_thumbnail($post_id, $img_id);
}
}
示例9: check_post_for_images
/**
* Cache images on post's saving
*/
function check_post_for_images($post_ID, $ablog, $item)
{
// Get the post so we can edit it.
$post = get_post($post_ID);
$images = $this->get_remote_images_in_content($post->post_content);
if (!empty($images)) {
// Include the file and media libraries as they have the functions we want to use
require_once ABSPATH . 'wp-admin/includes/file.php';
require_once ABSPATH . 'wp-admin/includes/media.php';
foreach ($images as $image) {
preg_match('/[^\\?]+\\.(jpe?g|jpe|gif|png)\\b/i', $image, $matches);
if (!empty($matches)) {
$this->grab_image_from_url($image, $post_ID);
}
}
// Set the first image as the featured one - from a snippet at http://wpengineer.com/2460/set-wordpress-featured-image-automatically/
$imageargs = array('numberposts' => 1, 'order' => 'ASC', 'post_mime_type' => 'image', 'post_parent' => $post_ID, 'post_status' => NULL, 'post_type' => 'attachment');
$cachedimages = get_children($imageargs);
if (!empty($cachedimages)) {
foreach ($cachedimages as $image_id => $image) {
set_post_thumbnail($post_ID, $image_id);
}
}
}
// Returning the $post_ID even though it's an action and we really don't need to
return $post_ID;
}
示例10: wds_set_media_as_featured_image
/**
* If a YouTube or Vimeo video is added in the post content, grab its thumbnail and set it as the featured image
*/
function wds_set_media_as_featured_image($post_id, $post)
{
$content = isset($post->post_content) ? $post->post_content : '';
// Only check the first 1000 characters of our post.
$content = substr($content, 0, 800);
// Props to @rzen for lending his massive brain smarts to help with the regex
$do_video_thumbnail = isset($post->ID) && !has_post_thumbnail($post_id) && $content && (preg_match('/\\/\\/(www\\.)?youtube\\.com\\/(watch|embed)\\/?(\\?v=)?([a-zA-Z0-9\\-\\_]+)/', $content, $youtube_matches) || preg_match('#https?://(.+\\.)?vimeo\\.com/.*#i', $content, $vimeo_matches));
if (!$do_video_thumbnail) {
return update_post_meta($post_id, '_is_video', false);
}
$video_thumbnail_url = false;
$youtube_id = $youtube_matches[4];
$vimeo_id = preg_replace("/[^0-9]/", "", $vimeo_matches[0]);
if ($youtube_id) {
// Check to see if our max-res image exists
$file_headers = get_headers('http://img.youtube.com/vi/' . $youtube_id . '/maxresdefault.jpg');
$video_thumbnail_url = $file_headers[0] !== 'HTTP/1.0 404 Not Found' ? 'http://img.youtube.com/vi/' . $youtube_id . '/maxresdefault.jpg' : 'http://img.youtube.com/vi/' . $youtube_id . '/hqdefault.jpg';
} elseif ($vimeo_id) {
$vimeo_data = wp_remote_get('http://www.vimeo.com/api/v2/video/' . intval($vimeo_id) . '.php');
if (isset($vimeo_data['response']['code']) && '200' == $vimeo_data['response']['code']) {
$response = unserialize($vimeo_data['body']);
$video_thumbnail_url = isset($response[0]['thumbnail_large']) ? $response[0]['thumbnail_large'] : false;
}
}
// If we found an image...
$attachment_id = $video_thumbnail_url && !is_wp_error($video_thumbnail_url) ? wds_ms_media_sideload_image_with_new_filename($video_thumbnail_url, $post_id, sanitize_title(get_the_title())) : 0;
// If attachment wasn't created, bail
if (!$attachment_id) {
return;
}
// Woot! we got an image, so set it as the post thumbnail
set_post_thumbnail($post_id, $attachment_id);
update_post_meta($post_id, '_is_video', true);
}
开发者ID:Art2u,项目名称:Automatic-Featured-Images-from-Videos,代码行数:37,代码来源:automatic-featured-images-from-videos.php
示例11: update_nav_fields
/**
* Save the new field data for the nav menu.
*
* @param $menu_id
* @param $menu_item_db_id
* @param $args
*/
public function update_nav_fields($menu_id, $menu_item_db_id, $args)
{
// Hide on mobile.
if (isset($_POST['hide-menu-on-mobile'][$menu_item_db_id])) {
update_post_meta($menu_item_db_id, 'hide_menu_on_mobile', empty($_POST['hide-menu-on-mobile'][$menu_item_db_id]) ? false : 'on');
} else {
delete_post_meta($menu_item_db_id, 'hide_menu_on_mobile');
}
// Image.
if (isset($_POST['menu-item-image']) && is_array($_POST['menu-item-image'])) {
if (!isset($_POST['menu-item-image'][$menu_item_db_id]) || !$_POST['menu-item-image'][$menu_item_db_id]) {
delete_post_thumbnail($menu_item_db_id);
}
if (isset($_POST['menu-item-image'][$menu_item_db_id])) {
set_post_thumbnail($menu_item_db_id, absint($_POST['menu-item-image'][$menu_item_db_id]));
}
}
if (isset($_POST['menu-item-icon']) && is_array($_POST['menu-item-icon'])) {
if (isset($_POST['menu-item-icon'][$menu_item_db_id])) {
update_post_meta($menu_item_db_id, '_menu_item_icon', sanitize_text_field($_POST['menu-item-icon'][$menu_item_db_id]));
}
}
if (isset($_POST['menu-item-widget-area']) && isset($_POST['menu-item-widget-area'][$menu_item_db_id]) && is_array($_POST['menu-item-widget-area'])) {
update_post_meta($menu_item_db_id, '_menu_item_widget_area', sanitize_text_field($_POST['menu-item-widget-area'][$menu_item_db_id]));
}
}
示例12: set_first_as_featured
function set_first_as_featured($attachment_ID)
{
$post_ID = get_post($attachment_ID)->post_parent;
if (!has_post_thumbnail($post_ID)) {
set_post_thumbnail($post_ID, $attachment_ID);
}
}
示例13: creatProject
function creatProject()
{
// echo '<pre>';
// print_r($_POST);
// print_r($_FILES);
// exit;
if ($_POST) {
$post_id = wp_insert_post(array('post_author' => get_current_user_id(), 'post_title' => $_POST['tieudeduan'], 'post_content' => $_POST['mieutanoidung'], 'post_type' => 'du-an', 'post_status' => 'publish'));
if ($_FILES['anhdaidien']['name']) {
require_once ABSPATH . '/wp-admin/includes/media.php';
require_once ABSPATH . '/wp-admin/includes/file.php';
require_once ABSPATH . '/wp-admin/includes/image.php';
$attachmentId = media_handle_upload('anhdaidien', $post_id);
set_post_thumbnail($post_id, $attachmentId);
}
// So luoc chien dich
add_post_meta($post_id, 'wpcf-dia-diem-du-an', $_POST['diadiemduan']);
add_post_meta($post_id, 'wpcf-so-tien-quyen-gop', $_POST['sotienquyengop']);
add_post_meta($post_id, 'wpcf-thoi-gian-bat-dau', strtotime($_POST['thoigianbatdau']));
add_post_meta($post_id, 'wpcf-thoi-gian-ket-thuc', strtotime($_POST['thoigianketthuc']));
add_post_meta($post_id, 'wpcf-mieu-ta-ngan', $_POST['mieutangan']);
//thong tin lien he
add_post_meta($post_id, 'wpcf-ho-va-ten', $_POST['hoten']);
add_post_meta($post_id, 'wpcf-email', $_POST['email']);
add_post_meta($post_id, 'wpcf-dia-chi', $_POST['diachi']);
add_post_meta($post_id, 'wpcf-so-dien-thoai', $_POST['sodt']);
add_post_meta($post_id, 'wpcf-so-goi-khan-cap', $_POST['sodtkhac']);
add_post_meta($post_id, 'wpcf-link-facebook', $_POST['facebook_url']);
add_post_meta($post_id, 'wpcf-so-tai-khoan', $_POST['sotk']);
add_post_meta($post_id, 'wpcf-ngay-sinh', strtotime($_POST['ngaysinh']));
echo json_encode(array('msg' => 'Giử yêu cầu thành công', 'err' => 0));
exit;
}
}
示例14: wpmp_add_product
function wpmp_add_product()
{
if (wp_verify_nonce($_POST['__product_wpmp'], 'wpmp-product') && $_POST['task'] == '') {
if ($_POST['post_type'] == "wpmarketplace") {
global $current_user, $wpdb;
get_currentuserinfo();
$my_post = array('post_title' => $_POST['product']['post_title'], 'post_content' => $_POST['product']['post_content'], 'post_excerpt' => $_POST['product']['post_excerpt'], 'post_status' => "draft", 'post_author' => $current_user->ID, 'post_type' => "wpmarketplace");
//echo $_POST['id'];
if ($_POST['id']) {
//update post
$my_post['ID'] = $_REQUEST['id'];
wp_update_post($my_post);
$postid = $_REQUEST['id'];
} else {
//insert post
$postid = wp_insert_post($my_post);
}
update_post_meta($postid, "wpmp_list_opts", $_POST['wpmp_list']);
foreach ($_POST['wpmp_list'] as $k => $v) {
update_post_meta($postid, $k, $v);
}
//echo $_POST['wpmp_list']['fimage'];
if ($_POST['wpmp_list']['fimage']) {
$wp_filetype = wp_check_filetype(basename($_POST['wpmp_list']['fimage']), null);
$attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($_POST['wpmp_list']['fimage'])), 'post_content' => '', 'guid' => $_POST['wpmp_list']['fimage'], 'post_status' => 'inherit');
$attach_id = wp_insert_attachment($attachment, $_POST['wpmp_list']['fimage'], $postid);
set_post_thumbnail($postid, $attach_id);
}
}
//echo $_SERVER['HTTP_REFERER'];
header("Location: " . $_SERVER['HTTP_REFERER']);
die;
}
}
示例15: frontier_clone_post
function frontier_clone_post($fpost_sc_parms = array())
{
//extract($fpost_sc_parms);
//echo "CLONE POST<br>";
$frontier_permalink = get_permalink();
$concat = get_option("permalink_structure") ? "?" : "&";
if (isset($_POST['task'])) {
$post_task = $_POST['task'];
} else {
if (isset($_GET['task'])) {
$post_task = $_GET['task'];
} else {
$post_task = "notaskset";
}
}
$post_action = isset($_POST['action']) ? $_POST['action'] : "Unknown";
if ($post_task == "clone" && $_REQUEST['postid']) {
$old_post = get_post($_REQUEST['postid']);
$old_post_id = $old_post->ID;
//double check current user can add a post with this post type
if (frontier_can_add($old_post->post_type)) {
require_once ABSPATH . '/wp-admin/includes/post.php';
global $current_user;
//Get permalink from old post
$old_permalink = get_permalink($old_post_id);
// lets clone it
$thispost = get_default_post_to_edit($fpost_sc_parms['frontier_add_post_type'], true);
$new_post_id = $thispost->ID;
$tmp_post = array('ID' => $new_post_id, 'post_type' => $old_post->post_type, 'post_title' => __("CLONED from", "frontier-post") . ': <a href="' . $old_permalink . '">' . $old_post->post_title . '</a>', 'post_content' => __("CLONED from", "frontier-post") . ': <a href="' . $old_permalink . '">' . $old_post->post_title . '</a><br>' . $old_post->post_content, 'post_status' => "draft", 'post_author' => $current_user->ID);
//****************************************************************************************************
// Apply filter before update of post
// filter: frontier_post_clone
// $tmp_post Array that holds the updated fields
// $old_post The post being cloed (Object)
//****************************************************************************************************
$tmp_post = apply_filters('frontier_post_clone', $tmp_post, $old_post);
// save post
wp_update_post($tmp_post);
//Get the updated post
$new_post = get_post($new_post_id);
//get all current post terms ad set them to the new post draft
$taxonomies = get_object_taxonomies($old_post->post_type);
// returns array of taxonomy names for post type, ex array("category", "post_tag");
foreach ($taxonomies as $taxonomy) {
$post_terms = wp_get_object_terms($old_post_id, $taxonomy, array('fields' => 'slugs'));
wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
}
// Set featured image:
$post_thumbnail_id = get_post_thumbnail_id($old_post_id);
if (intval($post_thumbnail_id) > 0) {
set_post_thumbnail($new_post_id, $post_thumbnail_id);
}
// Add/Update message
frontier_post_set_msg(__("Post Cloned and ready edit", "frontier-post") . ": " . $new_post->post_title);
frontier_post_set_msg(__("Post status set to Draft", "frontier-post"));
frontier_user_post_list($fpost_sc_parms);
}
}
}