本文整理匯總了PHP中td_demo_media::get_by_td_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP td_demo_media::get_by_td_id方法的具體用法?PHP td_demo_media::get_by_td_id怎麽用?PHP td_demo_media::get_by_td_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類td_demo_media
的用法示例。
在下文中一共展示了td_demo_media::get_by_td_id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add_post
static function add_post($params)
{
$new_post = array('post_title' => $params['title'], 'post_status' => 'publish', 'post_type' => 'post', 'post_content' => self::parse_content_file($params['file']), 'comment_status' => 'open', 'post_category' => $params['categories_id_array'], 'guid' => td_global::td_generate_unique_id());
//new post / page
$post_id = wp_insert_post($new_post);
// add our demo custom meta field, using this field we will delete all the pages
update_post_meta($post_id, 'td_demo_content', true);
if (!empty($params['post_format'])) {
set_post_format($post_id, $params['post_format']);
}
set_post_thumbnail($post_id, td_demo_media::get_by_td_id($params['featured_image_td_id']));
if (!empty($params['template'])) {
$td_post_theme_settings['td_post_template'] = $params['template'];
update_post_meta($post_id, 'td_post_theme_settings', $td_post_theme_settings, true);
}
if (!empty($params['featured_video_url'])) {
$tmp_meta['td_video'] = $params['featured_video_url'];
update_post_meta($post_id, 'td_post_video', $tmp_meta);
}
return $post_id;
}