本文整理汇总了PHP中Vc_Grid_Item::predefinedTemplates方法的典型用法代码示例。如果您正苦于以下问题:PHP Vc_Grid_Item::predefinedTemplates方法的具体用法?PHP Vc_Grid_Item::predefinedTemplates怎么用?PHP Vc_Grid_Item::predefinedTemplates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vc_Grid_Item
的用法示例。
在下文中一共展示了Vc_Grid_Item::predefinedTemplates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vc_vc_grid_item_form_field
function vc_vc_grid_item_form_field($settings, $value)
{
require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php');
require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php');
$output = '<div data-vc-grid-element="container">' . '<select data-vc-grid-element="value" type="hidden" name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-select ' . $settings['param_name'] . ' ' . $settings['type'] . '_field" ' . '>';
$vc_grid_item_templates = Vc_Grid_Item::predefinedTemplates();
if (is_array($vc_grid_item_templates)) {
foreach ($vc_grid_item_templates as $key => $data) {
$output .= '<option data-vc-link="' . esc_url(admin_url('post-new.php?post_type=vc_grid_item&vc_gitem_template=' . $key)) . '" value="' . $key . '"' . ($key === $value ? ' selected="true"' : '') . '>' . esc_html($data['name']) . '</option>';
}
}
$grid_item_posts = get_posts(array('posts_per_page' => '-1', 'orderby' => 'post_title', 'post_type' => Vc_Grid_Item_Editor::postType()));
foreach ($grid_item_posts as $post) {
$output .= '<option data-vc-link="' . esc_url(get_edit_post_link($post->ID)) . '"value="' . $post->ID . '"' . ((string) $post->ID === $value ? ' selected="true"' : '') . '>' . esc_html($post->post_title) . '</option>';
}
$output .= '</select></div>';
return $output;
}
示例2: getGridTemplates
public function getGridTemplates()
{
$list = Vc_Grid_Item::predefinedTemplates();
return $list;
}