本文整理汇总了PHP中FLBuilderModel::get_templates方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilderModel::get_templates方法的具体用法?PHP FLBuilderModel::get_templates怎么用?PHP FLBuilderModel::get_templates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLBuilderModel
的用法示例。
在下文中一共展示了FLBuilderModel::get_templates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_items
function get_items($request)
{
$templates = array();
$user_templates = get_posts(array('post_type' => 'fl-builder-template', 'orderby' => 'menu_order title', 'order' => 'ASC', 'posts_per_page' => -1, 'fl-builder-template-type' => 'layout'));
//$user_templates = FLBuilderModel::get_user_templates();
if (!empty($user_templates)) {
foreach ($user_templates as $post) {
$layout = get_post_meta($post->ID, '_fl_builder_data', true);
if ($layout) {
$categories = get_post_meta($post->ID, 'template_categories', true);
if (empty($categories)) {
$categories = array('saved');
}
$templates[] = array('handle' => $post->ID, 'label' => $post->post_title, 'description' => $post->post_excerpt, 'author' => $post->post_author, 'modified' => $post->post_modified, 'edit_link' => FLBuilderModel::get_edit_url($post->ID), 'categories' => $categories, 'type' => 'user', 'is_global' => get_post_meta($post->ID, '_fl_builder_template_global', true), 'is_editable' => true);
}
}
}
$template_data = FLBuilderModel::get_templates();
if (!empty($template_data)) {
foreach ($template_data as $data) {
$templates[] = array('handle' => $data->index, 'label' => $data->name, 'screenshot' => array('thumbnail' => FL_BUILDER_URL . 'img/templates/' . $data->image), 'author' => array('name' => 'Beaver Builder Team'), 'categories' => array($data->category), 'is_premium' => $data->premium, 'is_builtin' => true, 'type' => 'core');
}
}
$response = rest_ensure_response($templates);
return $response;
}
示例2: get_templates
function get_templates()
{
/*
$user_templates = get_posts( array(
'post_type' => 'fl-builder-template',
'orderby' => 'menu_order title',
'order' => 'ASC',
'posts_per_page' => -1,
'fl-builder-template-type' => 'layout'
));
*/
// Temp
$template_data = FLBuilderModel::get_templates();
return $template_data;
}