Ejemplo n.º 1
0
 public static function instance($options = array())
 {
     if (is_null(self::$instance) && CS_ACTIVE_METABOX) {
         self::$instance = new self($options);
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
<?php

if (!defined('ABSPATH')) {
    die;
}
// Cannot access pages directly.
/**
 *
 * CSFramework Metabox Config
 *
 * @since 1.0
 * @version 1.0
 *
 */
/**
 * options fields settings
 * @var array
 */
$metaboxes = array();
/**
 * Case study post type
 */
$metaboxes[] = array('id' => '_custom_meta_options', 'title' => 'Post Options', 'post_type' => 'casestudy', 'context' => 'side', 'priority' => 'default', 'sections' => array(array('name' => 'section_1', 'title' => 'View Case Study', 'icon' => 'fa fa-wifi', 'fields' => array(array('id' => 'show_casestudy_link', 'type' => 'switcher', 'title' => 'Show the link', 'default' => true)))));
$metaboxes[] = array('id' => '_casestudy_meta_fields', 'title' => 'Case Study', 'post_type' => 'casestudy', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'section_1', 'title' => 'Section 1', 'fields' => array(array('id' => 'casestudy_section1_title', 'type' => 'text', 'title' => 'Title', 'sanitize' => false), array('id' => 'casestudy_section1_image_select_option', 'type' => 'image_select', 'title' => 'Background Color', 'options' => array('blue' => get_template_directory_uri() . '/assets/img/color-picker-skyblue.png', 'green' => get_template_directory_uri() . '/assets/img/color-picker-green.png', 'grey' => get_template_directory_uri() . '/assets/img/color-picker-grey.png', 'purple' => get_template_directory_uri() . '/assets/img/color-picker-purple.png', 'red' => get_template_directory_uri() . '/assets/img/color-picker-red.png', 'yellow' => get_template_directory_uri() . '/assets/img/color-picker-yellow.png'), 'default' => 'skyblue'), array('id' => 'casestudy_section1_description', 'type' => 'wysiwyg', 'title' => 'Description'), array('id' => 'casestudy_section1_image', 'type' => 'upload', 'title' => 'Select an Image', 'settings' => array('upload_type' => 'image', 'button_title' => 'Upload', 'frame_title' => 'Select an image', 'insert_title' => 'Use this image')))), array('name' => 'section_2', 'title' => 'Section 2', 'fields' => array(array('id' => 'casestudy_section2_title', 'type' => 'text', 'title' => 'Title', 'sanitize' => false), array('id' => 'casestudy_section2_description', 'type' => 'wysiwyg', 'title' => 'Description'), array('id' => 'casestudy_section2_gallery', 'type' => 'group', 'title' => 'Photos', 'button_title' => 'Add New', 'accordion_title' => 'Add New Photo', 'fields' => array(array('id' => 'casestudy_section2_uploader', 'type' => 'upload', 'title' => 'Select an Image', 'settings' => array('upload_type' => 'image', 'button_title' => 'Upload', 'frame_title' => 'Select an image', 'insert_title' => 'Use this image')))))), array('name' => 'section_3', 'title' => 'Section 3', 'fields' => array(array('id' => 'casestudy_section3_title', 'type' => 'text', 'title' => 'Title', 'sanitize' => false), array('id' => 'casestudy_section3_description', 'type' => 'wysiwyg', 'title' => 'Description'), array('id' => 'casestudy_section3_image', 'type' => 'upload', 'title' => 'Select an Image', 'settings' => array('upload_type' => 'image', 'button_title' => 'Upload', 'frame_title' => 'Select an image', 'insert_title' => 'Use this image'))))));
/**
 * Single post
 */
$metaboxes[] = array('id' => '_custom_meta_options', 'title' => 'Post Options', 'post_type' => 'post', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'section_1', 'title' => 'Post section', 'icon' => 'fa fa-wifi', 'fields' => array(array('id' => 'wd_blog_second_heading', 'type' => 'wysiwyg', 'title' => 'Second Post Heading')))));
CSFramework_Metabox::instance($metaboxes);
if (!defined('ABSPATH')) {
    die;
}
//不能直接访问网页.
// ===============================================================================================
// -----------------------------------------------------------------------------------------------
// 文章和页面属性选项
// -----------------------------------------------------------------------------------------------
// ===============================================================================================
$options = array();
// -----------------------------------------
// 页面选项                -
// -----------------------------------------
$options[] = array('id' => 'default_page', 'title' => '默认模板选项', 'post_type' => 'page', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'page_section_1', 'fields' => array())));
$options[] = array('id' => 'archive_page', 'title' => '归档模板选项', 'post_type' => 'page', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'page_section_1', 'fields' => array())));
$options[] = array('id' => 'friend_page', 'title' => '友链模板选项', 'post_type' => 'page', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'page_section_1', 'fields' => array())));
$options[] = array('id' => 'message_page', 'title' => '留意模板选项', 'post_type' => 'page', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'page_section_1', 'fields' => array())));
// -----------------------------------------
// 文章属性选项                    -
// -----------------------------------------
// 标准文章选项
$options[] = array('id' => 'standard_options', 'title' => '标准文章选项', 'post_type' => 'post', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'standard_section_1', 'fields' => array())));
// 日志文章选项
$options[] = array('id' => 'aside_options', 'title' => '日志文章选项', 'post_type' => 'post', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'aside_section_1', 'fields' => array(array('id' => 'i_post_music', 'type' => 'text', 'title' => '音乐外链', 'help' => '前提是正确开启Cue播放器,并且Cue歌单里存在歌曲', 'attributes' => array('placeholder' => 'http://...'))))));
// -----------------------------------------
// 作品属性选项                    -
// -----------------------------------------
// 日志文章选项
$options[] = array('id' => 'work_options', 'title' => '作品选项', 'post_type' => 'work', 'context' => 'normal', 'priority' => 'default', 'sections' => array(array('name' => 'aside_section_1', 'fields' => array(array('id' => 'i_work_featured', 'type' => 'radio', 'title' => '内页特色图', 'class' => 'horizontal', 'options' => array('i_featured' => '特色图', 'i_slider' => '轮播图'), 'default' => 'i_featured'), array('id' => 'i_work_custom', 'type' => 'group', 'title' => '自定义轮播图', 'info' => '更多详细设置方式可以浏览使用说明', 'dependency' => array('i_work_featured_i_slider', '==', 'true'), 'button_title' => '添加滑块', 'accordion_title' => '滑块', 'fields' => array(array('id' => 'i_work_title', 'type' => 'text', 'title' => '标题', 'attributes' => array('placeholder' => '例如:滑块01')), array('id' => 'i_work_image', 'type' => 'upload', 'title' => '图片'), array('id' => 'i_work_link', 'type' => 'text', 'title' => '链接', 'attributes' => array('placeholder' => 'http://...')), array('id' => 'i_work_newtab', 'type' => 'switcher', 'title' => '新标签打开', 'dependency' => array('i_work_link', '!=', '')))), array('id' => 'i_work_bg', 'type' => 'switcher', 'title' => '自定义背景图片'), array('id' => 'i_work_bg_scr', 'type' => 'upload', 'title' => '设置背景图片', 'help' => '', 'default' => get_template_directory_uri() . "/images/work_bg.jpg", 'help' => '建议使用模糊背景图片', 'dependency' => array('i_work_bg', '==', 'true')), array('id' => 'i_work_comment', 'type' => 'switcher', 'title' => '开启评论')))));
CSFramework_Metabox::instance($options);
Ejemplo n.º 4
0
function codestar_init()
{
    $options = array();
    CSFramework_Metabox::instance($options);
}