本文整理汇总了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;
}