function as_register_meta_boxes()
{
    global $meta_boxes, $is_activated;
    if (class_exists('RW_Meta_Box')) {
        foreach ($meta_boxes as $meta_box) {
            if (isset($meta_box['only_on']) and !rw_maybe_include($meta_box['only_on'], $meta_box['id'])) {
                continue;
            }
            new RW_Meta_Box($meta_box);
        }
    }
}
/**
 * Register meta boxes
 *
 * @return void
 */
function rw_register_meta_boxes()
{
    global $meta_boxes;
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if (class_exists('RW_Meta_Box')) {
        foreach ($meta_boxes as $meta_box) {
            if (isset($meta_box['only_on']) && !rw_maybe_include($meta_box['only_on'])) {
                continue;
            }
            new RW_Meta_Box($meta_box);
        }
    }
}
/**
 * Register meta boxes
 *
 * @return void
 */
function rw_register_meta_boxes()
{
    global $meta_boxes;
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if (!class_exists('RW_Meta_Box')) {
        return;
    }
    // Register meta boxes only for some posts/pages
    if (!rw_maybe_include()) {
        return;
    }
    foreach ($meta_boxes as $meta_box) {
        new RW_Meta_Box($meta_box);
    }
}
示例#4
0
/**
 * Register meta boxes
 *
 * @return void
 */
function coope_register_meta_boxes()
{
    global $meta_boxes;
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if (class_exists('RW_Meta_Box')) {
        foreach ($meta_boxes as $meta_box) {
            if ($meta_box['id'] == "fw_slider_page_meta_box") {
                if (rw_maybe_include("template-fw-slider.php")) {
                    new RW_Meta_Box($meta_box);
                }
            } else {
                new RW_Meta_Box($meta_box);
            }
        }
    }
}
示例#5
0
function _custom_meta_boxes()
{
    $prefix = 'sp_';
    /*  Custom meta boxes
    /* ------------------------------------ */
    $page_layout_options = array('id' => 'page-options', 'title' => 'Page Options', 'desc' => '', 'pages' => array('page', 'post'), 'context' => 'normal', 'priority' => 'default', 'fields' => array(array('label' => 'Primary Sidebar', 'id' => $prefix . 'sidebar_primary', 'type' => 'sidebar-select', 'desc' => 'Overrides default'), array('label' => 'Layout', 'id' => $prefix . 'layout', 'type' => 'radio-image', 'desc' => 'Overrides the default layout option', 'std' => 'inherit', 'choices' => array(array('value' => 'inherit', 'label' => 'Inherit Layout', 'src' => SP_ASSETS . '/images/admin/layout-off.png'), array('value' => 'col-1c', 'label' => '1 Column', 'src' => SP_ASSETS . '/images/admin/col-1c.png'), array('value' => 'col-2cl', 'label' => '2 Column Left', 'src' => SP_ASSETS . '/images/admin/col-2cl.png'), array('value' => 'col-2cr', 'label' => '2 Column Right', 'src' => SP_ASSETS . '/images/admin/col-2cr.png')))));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: video
    /* ---------------------------------------------------------------------- */
    $post_format_video = array('id' => 'format-video', 'title' => 'Format: Video', 'desc' => 'These settings enable you to embed videos into your posts.', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Video URL', 'id' => $prefix . 'video_url', 'type' => 'text', 'desc' => 'Enter Video Embed URL from youtube, vimeo or dailymotion')));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: Audio
    /* ---------------------------------------------------------------------- */
    $post_format_audio = array('id' => 'format-audio', 'title' => 'Format: Audio', 'desc' => 'These settings enable you to embed audio into your posts. You must provide both .mp3 and .ogg/.oga file formats in order for self hosted audio to function accross all browsers.', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Audio URL', 'id' => $prefix . 'audio_url', 'type' => 'upload', 'desc' => 'You can get sound or audio URL from soundcloud')));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: Gallery
    /* ---------------------------------------------------------------------- */
    $post_format_gallery = array('id' => 'format-gallery', 'title' => 'Format: Gallery', 'desc' => 'Standard post galleries.</i>', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Upload photo', 'id' => $prefix . 'post_gallery', 'type' => 'gallery', 'desc' => 'Upload photos')));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: Chat
    /* ---------------------------------------------------------------------- */
    $post_format_chat = array('id' => 'format-chat', 'title' => 'Format: Chat', 'desc' => 'Input chat dialogue.', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Chat Text', 'id' => $prefix . 'chat', 'type' => 'textarea', 'rows' => '2')));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: Link
    /* ---------------------------------------------------------------------- */
    $post_format_link = array('id' => 'format-link', 'title' => 'Format: Link', 'desc' => 'Input your link.', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Link Title', 'id' => $prefix . 'link_title', 'type' => 'text'), array('label' => 'Link URL', 'id' => $prefix . 'link_url', 'type' => 'text')));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: quote
    /* ---------------------------------------------------------------------- */
    $post_format_quote = array('id' => 'format-quote', 'title' => 'Format: Quote', 'desc' => 'Input your quote.', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Quote', 'id' => $prefix . 'quote', 'type' => 'textarea', 'rows' => '2'), array('label' => 'Quote Author', 'id' => $prefix . 'quote_author', 'type' => 'text')));
    /* ---------------------------------------------------------------------- */
    /*	Portfolio post type
    /* ---------------------------------------------------------------------- */
    $post_type_portfolio = array('id' => 'project-setting', 'title' => 'Project meta', 'desc' => '', 'pages' => array('sp_portfolio'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Project slide', 'id' => $prefix . 'project_slide', 'type' => 'upload', 'desc' => 'Upload photo to show in project slideshow'), array('label' => 'Project detail photos', 'id' => $prefix . 'project_gallery', 'type' => 'gallery', 'desc' => 'Upload list of photos to show in project detail page')));
    /* ---------------------------------------------------------------------- */
    /*	Gallery post type
    /* ---------------------------------------------------------------------- */
    $post_type_gallery = array('id' => 'gallery-setting', 'title' => 'Gallery meta', 'desc' => '', 'pages' => array('sp_gallery'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Upload photos', 'id' => $prefix . 'cp_gallery', 'type' => 'gallery', 'desc' => 'Upload gallery photos')));
    /* ---------------------------------------------------------------------- */
    /*	Metabox for about template
    /* ---------------------------------------------------------------------- */
    $page_template_about = array('id' => 'about-settings', 'title' => 'About settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Team Gallery', 'id' => $prefix . 'team_gallery', 'type' => 'custom-post-type-select', 'post_type' => 'sp_gallery')));
    /* ---------------------------------------------------------------------- */
    /*	Metabox for client
    /* ---------------------------------------------------------------------- */
    $post_type_client = array('id' => 'client-settings', 'title' => 'Client meta', 'desc' => '', 'pages' => array('sp_client'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Link Client', 'id' => $prefix . 'link_client', 'type' => 'text', 'std' => '#', 'desc' => 'Enter link of client e.g. www.novacambodia.com')));
    /* ---------------------------------------------------------------------- */
    /*	Metabox for Home template
    /* ---------------------------------------------------------------------- */
    $page_template_home = array('id' => 'home-settings', 'title' => 'Home settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Projects', 'id' => $prefix . 'slide_options', 'type' => 'tab'), array('label' => 'Number of Slide to show', 'id' => $prefix . 'slide_num', 'type' => 'text', 'std' => '4', 'desc' => 'Enter number of slide e.g. 5'), array('label' => 'Number of Slide to show', 'id' => $prefix . 'slide_effect', 'type' => 'select', 'std' => '', 'desc' => '', 'choices' => array(array('value' => 'fade', 'label' => 'Fade', 'src' => ''), array('value' => 'slide', 'label' => 'Slide', 'src' => ''))), array('label' => 'Clients', 'id' => $prefix . 'client_options', 'type' => 'tab'), array('label' => 'Section title', 'id' => $prefix . 'client_title', 'type' => 'text', 'std' => 'Current and past clients'), array('label' => 'Number of partner\'s logo', 'id' => $prefix . 'client_num', 'type' => 'text', 'std' => '-1', 'desc' => 'Enter number of client message e.g. 10')));
    /* ---------------------------------------------------------------------- */
    /*	Return meta box option base on page template selected
    /* ---------------------------------------------------------------------- */
    function rw_maybe_include()
    {
        // Include in back-end only
        if (!defined('WP_ADMIN') || !WP_ADMIN) {
            return false;
        }
        // Always include for ajax
        if (defined('DOING_AJAX') && DOING_AJAX) {
            return true;
        }
        if (isset($_GET['post'])) {
            $post_id = $_GET['post'];
        } elseif (isset($_POST['post_ID'])) {
            $post_id = $_POST['post_ID'];
        } else {
            $post_id = false;
        }
        $post_id = (int) $post_id;
        $post = get_post($post_id);
        $template = get_post_meta($post_id, '_wp_page_template', true);
        return $template;
    }
    /*  Register meta boxes
    /* ------------------------------------ */
    ot_register_meta_box($post_format_audio);
    ot_register_meta_box($post_format_chat);
    ot_register_meta_box($post_format_gallery);
    ot_register_meta_box($post_format_link);
    ot_register_meta_box($post_format_quote);
    ot_register_meta_box($post_format_video);
    ot_register_meta_box($post_type_portfolio);
    ot_register_meta_box($post_type_gallery);
    ot_register_meta_box($post_type_client);
    $template_file = rw_maybe_include();
    if ($template_file == 'template-home.php') {
        ot_register_meta_box($page_template_home);
    } elseif ($template_file == 'template-about.php') {
        ot_register_meta_box($page_template_about);
    } else {
        ot_register_meta_box($page_layout_options);
    }
}
示例#6
0
/**
 * Register meta boxes
 *
 * @return void
 */
function sf_register_meta_boxes()
{
    global $meta_boxes;
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if (class_exists('RW_Meta_Box')) {
        foreach ($meta_boxes as $meta_box) {
            if ($meta_box['id'] == "page_meta_box") {
                if (!rw_maybe_include("woocommerce.php")) {
                    new RW_Meta_Box($meta_box);
                }
            } else {
                new RW_Meta_Box($meta_box);
            }
        }
    }
}
示例#7
0
function _custom_meta_boxes()
{
    $prefix = 'sp_';
    // Page layout
    $page_layout_options = array('id' => 'page-options', 'title' => 'Page Options', 'desc' => '', 'pages' => array('page', 'post', 'cp_team', 'cp_gallery'), 'context' => 'normal', 'priority' => 'default', 'fields' => array(array('label' => 'Primary Sidebar', 'id' => $prefix . 'sidebar_primary', 'type' => 'sidebar-select', 'desc' => 'Overrides default'), array('label' => 'Layout', 'id' => $prefix . 'layout', 'type' => 'radio-image', 'desc' => 'Overrides the default layout option', 'std' => 'inherit', 'choices' => array(array('value' => 'inherit', 'label' => 'Inherit Layout', 'src' => WPSP_BASE_URL . '/images/admin/layout-off.png'), array('value' => 'col-1c', 'label' => '1 Column', 'src' => WPSP_BASE_URL . '/images/admin/col-1c.png'), array('value' => 'col-2cl', 'label' => '2 Column Left', 'src' => WPSP_BASE_URL . '/images/admin/col-2cl.png'), array('value' => 'col-2cr', 'label' => '2 Column Right', 'src' => WPSP_BASE_URL . '/images/admin/col-2cr.png')))));
    // Post Format: Video
    $post_format_video = array('id' => 'format-video', 'title' => 'Video settings', 'desc' => 'These settings enable you to embed videos into your posts.', 'pages' => array('post', 'cp_launcher'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Video URL', 'id' => $prefix . 'video_url', 'type' => 'text', 'desc' => 'Enter Video Embed URL from youtube, vimeo or dailymotion')));
    // Post Format: Audio
    $post_format_audio = array('id' => 'format-audio', 'title' => 'Audio settings', 'desc' => 'These settings enable you to embed soundcloud into your posts.', 'pages' => array('post', 'cp_launcher'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Soundcloud URL', 'id' => $prefix . 'sound_url', 'type' => 'text', 'desc' => 'Enter share URL of sound from Soundcloud'), array('label' => 'Guest speaker name', 'id' => $prefix . 'speaker_name', 'type' => 'text', 'desc' => 'Enter name of guest speaker'), array('label' => 'Position', 'id' => $prefix . 'speaker_position', 'type' => 'text', 'desc' => 'Enter position of guest speaker. e.g: Project officer'), array('label' => 'Organization or Company Name', 'id' => $prefix . 'speaker_work_place', 'type' => 'text', 'desc' => 'Enter Organization/Company name where they working for. e.g: United Nations Population Fund  (UNFPA)')));
    // Post Format: Gallery
    $post_format_gallery = array('id' => 'format-gallery', 'title' => 'Format: Gallery', 'desc' => 'These settings enable you to present photos as slideshow in post', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Upload photo', 'id' => $prefix . 'gallery', 'type' => 'gallery', 'desc' => 'Upload photos')));
    //Page template setting for TV, Radio, Online resource and Page klahan9
    $page_template_settings = array('id' => 'page-template-settings', 'title' => 'Page settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('Masthead', 'wpsp'), 'id' => 'tab_masthead', 'type' => 'tab'), array('label' => 'Masthead', 'id' => $prefix . 'masthead', 'type' => 'upload', 'desc' => 'Upload heading image for masthead page. Size: 960px by 150px'), array('label' => __('Post Featured', 'wpsp'), 'id' => 'tab_post_featuerd', 'type' => 'tab'), array('label' => 'Featured category', 'id' => $prefix . 'post_by_cat', 'type' => 'category-select', 'desc' => 'Choose category show featured post for page'), array('label' => 'Page background color', 'id' => $prefix . 'page_bg_color', 'type' => 'colorpicker', 'desc' => 'Choose color for page background')));
    //Page template setting for TV
    $page_tv_template_settings = array('id' => 'page-tv-template-settings', 'title' => 'Addon settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('Star Team', 'wpsp'), 'id' => 'tab_star_team', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'star_team_title', 'type' => 'text', 'std' => 'Meet the star', 'desc' => 'Enter title for this section e.g: Meet the Star'), array('label' => 'Star team', 'id' => $prefix . 'star_team_tax', 'type' => 'taxonomy-select', 'taxonomy' => 'team_category', 'desc' => 'Select Star team category e.g: Meet the Star'), array('label' => 'Amount of people', 'id' => $prefix . 'star_team_num', 'type' => 'select', 'std' => '8', 'desc' => 'Choose amount of people to show', 'choices' => array(array('value' => '5', 'label' => '5', 'src' => ''), array('value' => '6', 'label' => '6', 'src' => ''), array('value' => '7', 'label' => '7', 'src' => ''), array('value' => '8', 'label' => '8', 'src' => ''), array('value' => '9', 'label' => '9', 'src' => ''), array('value' => '10', 'label' => '10', 'src' => ''))), array('label' => 'Star Team text link', 'id' => $prefix . 'star_team_text_link', 'type' => 'text', 'std' => 'More people', 'desc' => 'Title link for Star team'), array('label' => 'Star Team page link', 'id' => $prefix . 'star_team_page_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page link for Star team group'), array('label' => __('TV Team', 'wpsp'), 'id' => 'tab_tv_team', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'tv_team_title', 'type' => 'text', 'std' => 'Meet TV team', 'desc' => 'Enter title for this section e.g: Meet the Star'), array('label' => 'TV team', 'id' => $prefix . 'tv_team_tax', 'type' => 'taxonomy-select', 'taxonomy' => 'team_category', 'desc' => 'Select TV team category e.g: Meet tv team'), array('label' => 'Amount of people', 'id' => $prefix . 'tv_team_num', 'type' => 'select', 'std' => '4', 'desc' => 'Choose amount of people to show', 'choices' => array(array('value' => '5', 'label' => '5', 'src' => ''), array('value' => '6', 'label' => '6', 'src' => ''), array('value' => '7', 'label' => '7', 'src' => ''), array('value' => '8', 'label' => '8', 'src' => ''), array('value' => '9', 'label' => '9', 'src' => ''), array('value' => '10', 'label' => '10', 'src' => ''))), array('label' => 'TV Team text link', 'id' => $prefix . 'tv_team_text_link', 'type' => 'text', 'std' => 'More people', 'desc' => 'Title link for TV team'), array('label' => 'TV Team page link', 'id' => $prefix . 'tv_team_page_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page link for TV team group'), array('label' => __('Launcher', 'wpsp'), 'id' => 'tab_launcher', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'launcher_title', 'type' => 'text', 'std' => 'TV launcher', 'desc' => 'Enter title for this section'), array('label' => 'Launcher category', 'id' => $prefix . 'launcher_tax', 'type' => 'taxonomy-select', 'taxonomy' => 'launcher_category', 'desc' => 'Select TV show category'), array('label' => 'Amount of launcher', 'id' => $prefix . 'launcher_num', 'type' => 'select', 'std' => '4', 'desc' => 'Choose amount of media to show', 'choices' => array(array('value' => '2', 'label' => '2', 'src' => ''), array('value' => '3', 'label' => '3', 'src' => ''), array('value' => '4', 'label' => '4', 'src' => ''), array('value' => '5', 'label' => '5', 'src' => ''))), array('label' => 'Launcher text link', 'id' => $prefix . 'launcher_text_link', 'type' => 'text', 'std' => 'More launcher', 'desc' => 'Title link for TV launcher'), array('label' => 'Launcher page link', 'id' => $prefix . 'launcher_page_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page that contained all of tv launcher'), array('label' => __('Gallery', 'wpsp'), 'id' => 'tab_gallery', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'tv_photo_title', 'type' => 'text', 'std' => 'Behind the scenes', 'desc' => 'Enter title for this section e.g: Behind the scenes'), array('label' => 'TV photo album', 'id' => $prefix . 'album_term', 'type' => 'taxonomy-select', 'taxonomy' => 'gallery_category', 'desc' => 'Select category TV photo album'), array('label' => 'Amount of albums', 'id' => $prefix . 'tv_photo_num', 'type' => 'select', 'std' => '4', 'desc' => 'Choose amount of albums to show', 'choices' => array(array('value' => '2', 'label' => '2', 'src' => ''), array('value' => '3', 'label' => '3', 'src' => ''), array('value' => '4', 'label' => '4', 'src' => ''), array('value' => '5', 'label' => '5', 'src' => ''))), array('label' => 'Photo text link', 'id' => $prefix . 'tv_photo_text_link', 'type' => 'text', 'std' => 'More photos', 'desc' => 'Title link for TV Photo'), array('label' => 'TV album page link', 'id' => $prefix . 'tv_photo_page_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page link to TV photo gallery'), array('label' => __('Callout', 'wpsp'), 'id' => 'tab_callout', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'callout_title', 'type' => 'text', 'std' => 'Ready For a New Job or a Career Change?', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'callout_desc', 'type' => 'textarea', 'rows' => '3', 'std' => 'Klahan9 provided more information & documents with difference ways and experiences to make everyone have good career opportunity.', 'desc' => ''), array('label' => 'Button title', 'id' => $prefix . 'callout_button', 'type' => 'text', 'std' => 'Online Resource', 'desc' => ''), array('label' => 'Button link', 'id' => $prefix . 'callout_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page link for Callout button link'), array('label' => 'Callout color settings', 'id' => $prefix . 'callout_border', 'type' => 'textblock', 'std' => '', 'desc' => 'Use custom field bellow to change callout color schema'), array('label' => 'Background color', 'id' => $prefix . 'callout_bg_color', 'type' => 'colorpicker', 'std' => '#bf311a', 'desc' => 'Select background color for callout message'), array('label' => 'Text color', 'id' => $prefix . 'callout_txt_color', 'type' => 'colorpicker', 'std' => '#ffffff', 'desc' => 'Select color for text message and button'), array('label' => 'Button background color', 'id' => $prefix . 'callout_btn_bg_color', 'type' => 'colorpicker', 'std' => '#680b03', 'desc' => 'Select background color for button'), array('label' => 'Button hover color', 'id' => $prefix . 'callout_btn_over_color', 'type' => 'colorpicker', 'std' => '#4285f4', 'desc' => 'Select mouse over color for button')));
    //Page template setting for Radio
    $page_radio_template_settings = array('id' => 'page-radio-template-settings', 'title' => 'Addon settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('Schedule', 'wpsp'), 'id' => 'tab_schedule', 'type' => 'tab'), array('label' => 'All topics title', 'id' => $prefix . 'radio_all_topic_title', 'type' => 'text', 'std' => 'Listen all topics', 'desc' => 'Enter title to listen all topics'), array('label' => 'All topics link', 'id' => $prefix . 'radio_all_topic_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page link to listen all topics'), array('label' => 'Schedule banner', 'id' => $prefix . 'schedule_banner', 'type' => 'upload', 'desc' => 'Recommend square image banner. e.g: 310px by 310px'), array('label' => 'Title', 'id' => $prefix . 'radio_topic_title', 'type' => 'text', 'std' => 'Topic next month', 'desc' => 'Enter title for this section e.g: Topic next month'), array('label' => 'Topic category', 'id' => $prefix . 'radio_topic_cat', 'type' => 'category-select', 'std' => '', 'desc' => 'Select Radio, listen to broadcast or radio drama category to show in table schedule.'), array('label' => 'Number of topic', 'id' => $prefix . 'radio_topic_num', 'type' => 'text', 'std' => '5', 'desc' => 'Enter amount of topic to show'), array('label' => 'Topic order', 'id' => $prefix . 'radio_topic_order', 'type' => 'select', 'std' => 'ASC', 'desc' => 'Select order type for topic. ASC (1, 2, 3; a, b, c) or DESC (3, 2, 1; c, b, a)', 'choices' => array(array('value' => 'ASC', 'label' => 'ASC', 'src' => ''), array('value' => 'DESC', 'label' => 'DESC', 'src' => ''))), array('label' => __('Team', 'wpsp'), 'id' => 'tab_team', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'radio_team_title', 'type' => 'text', 'std' => 'Meet the radio team', 'desc' => 'Enter title for this section e.g: Meet the radio team'), array('label' => 'TV team', 'id' => $prefix . 'team_tax', 'type' => 'taxonomy-select', 'taxonomy' => 'team_category', 'desc' => 'Select TV team category e.g: Meet the Star'), array('label' => 'Amount of people', 'id' => $prefix . 'radio_team_num', 'type' => 'select', 'std' => '4', 'desc' => 'Choose amount of people to show', 'choices' => array(array('value' => '5', 'label' => '5', 'src' => ''), array('value' => '6', 'label' => '6', 'src' => ''), array('value' => '7', 'label' => '7', 'src' => ''), array('value' => '8', 'label' => '8', 'src' => ''), array('value' => '9', 'label' => '9', 'src' => ''), array('value' => '10', 'label' => '10', 'src' => ''))), array('label' => 'Team text link', 'id' => $prefix . 'radio_team_text_link', 'type' => 'text', 'std' => 'More people', 'desc' => 'Title link for Radio team'), array('label' => 'Team page link', 'id' => $prefix . 'radio_team_page_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page link for Radio team group'), array('label' => __('Launcher', 'wpsp'), 'id' => 'tab_launcher', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'launcher_title', 'type' => 'text', 'std' => 'Radio launcher', 'desc' => 'Enter title for this section'), array('label' => 'Launcher category', 'id' => $prefix . 'launcher_tax', 'type' => 'taxonomy-select', 'taxonomy' => 'launcher_category', 'desc' => 'Select Radio show category'), array('label' => 'Amount of launcher', 'id' => $prefix . 'launcher_num', 'type' => 'select', 'std' => '4', 'desc' => 'Choose amount of media to show', 'choices' => array(array('value' => '2', 'label' => '2', 'src' => ''), array('value' => '3', 'label' => '3', 'src' => ''), array('value' => '4', 'label' => '4', 'src' => ''), array('value' => '5', 'label' => '5', 'src' => ''))), array('label' => 'Launcher text link', 'id' => $prefix . 'launcher_text_link', 'type' => 'text', 'std' => 'More launcher', 'desc' => 'Title link for Radio launcher'), array('label' => 'Launcher page link', 'id' => $prefix . 'launcher_page_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page that contained all of Radio launcher'), array('label' => __('Gallery', 'wpsp'), 'id' => 'tab_gallery', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'radio_photo_title', 'type' => 'text', 'std' => 'Weekly photos', 'desc' => 'Enter title for this section e.g: Weekly photos'), array('label' => 'Radio photo album', 'id' => $prefix . 'album_term', 'type' => 'taxonomy-select', 'taxonomy' => 'gallery_category', 'desc' => 'Select category Radio photo album'), array('label' => 'Amount of photo', 'id' => $prefix . 'radio_photo_num', 'type' => 'select', 'std' => '4', 'desc' => 'Choose amount of photo to show', 'choices' => array(array('value' => '2', 'label' => '2', 'src' => ''), array('value' => '3', 'label' => '3', 'src' => ''), array('value' => '4', 'label' => '4', 'src' => ''), array('value' => '5', 'label' => '5', 'src' => ''))), array('label' => 'Photo text link', 'id' => $prefix . 'radio_photo_text_link', 'type' => 'text', 'std' => 'More photos', 'desc' => 'Title link for Radio Photo'), array('label' => 'Radio album page link', 'id' => $prefix . 'radio_photo_page_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page link to Radio photo gallery'), array('label' => __('Callout', 'wpsp'), 'id' => 'tab_callout', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'callout_title', 'type' => 'text', 'std' => 'Ready For a New Job or a Career Change?', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'callout_desc', 'type' => 'textarea', 'rows' => '3', 'std' => 'Klahan9 provided more information & documents with difference ways and experiences to make everyone have good career opportunity.', 'desc' => ''), array('label' => 'Button title', 'id' => $prefix . 'callout_button', 'type' => 'text', 'std' => 'Online Resource', 'desc' => ''), array('label' => 'Button link', 'id' => $prefix . 'callout_link', 'type' => 'page-select', 'std' => '', 'desc' => 'Select page link for Callout button link'), array('label' => 'Callout color settings', 'id' => $prefix . 'callout_border', 'type' => 'textblock', 'std' => '', 'desc' => 'Use custom field bellow to change callout color schema'), array('label' => 'Background color', 'id' => $prefix . 'callout_bg_color', 'type' => 'colorpicker', 'std' => '#bf311a', 'desc' => 'Select background color for callout message'), array('label' => 'Text color', 'id' => $prefix . 'callout_txt_color', 'type' => 'colorpicker', 'std' => '#ffffff', 'desc' => 'Select color for text message and button'), array('label' => 'Button background color', 'id' => $prefix . 'callout_btn_bg_color', 'type' => 'colorpicker', 'std' => '#680b03', 'desc' => 'Select background color for button'), array('label' => 'Button hover color', 'id' => $prefix . 'callout_btn_over_color', 'type' => 'colorpicker', 'std' => '#4285f4', 'desc' => 'Select mouse over color for button')));
    //Monthly topic template setting for Radio
    $radio_monthly_topic_template_settings = array('id' => 'page-radio-monthly-topic-template-settings', 'title' => 'Topic settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Radio category', 'id' => $prefix . 'post_by_cat', 'type' => 'category-select', 'desc' => 'Choose category to show topics'), array('label' => 'Select year', 'id' => $prefix . 'yearly_topic', 'type' => 'select', 'desc' => 'Show weekly topic by year', 'choices' => array(array('value' => '2015', 'label' => '2015', 'src' => ''), array('value' => '2016', 'label' => '2016', 'src' => ''), array('value' => '2017', 'label' => '2017', 'src' => ''), array('value' => '2018', 'label' => '2018', 'src' => ''), array('value' => '2019', 'label' => '2019', 'src' => ''), array('value' => '2020', 'label' => '2020', 'src' => '')))));
    //Page template setting for Home
    $page_home_template_settings = array('id' => 'page-home-template-settings', 'title' => 'Message Settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('TV', 'wpsp'), 'id' => 'tab_tv', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'tv_title', 'type' => 'text', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'tv_desc', 'type' => 'textarea', 'rows' => '3', 'desc' => 'Enter short description for TV'), array('label' => 'Link', 'id' => $prefix . 'tv_link', 'type' => 'page-select', 'desc' => 'Select TV Landing page to be link to'), array('label' => __('Online', 'wpsp'), 'id' => 'tab_online', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'online_title', 'type' => 'text', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'online_desc', 'type' => 'textarea', 'rows' => '3', 'desc' => 'Enter short description for Online'), array('label' => 'Link', 'id' => $prefix . 'online_link', 'type' => 'page-select', 'desc' => 'Select Online Landing page to be link to'), array('label' => __('Radio', 'wpsp'), 'id' => 'tab_radio', 'type' => 'tab'), array('label' => 'Title', 'id' => $prefix . 'radio_title', 'type' => 'text', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'radio_desc', 'type' => 'textarea', 'rows' => '3', 'desc' => 'Enter short description for Radio'), array('label' => 'Link', 'id' => $prefix . 'radio_link', 'type' => 'page-select', 'desc' => 'Select Radio Landing page to be link to')));
    // Team post type
    $post_type_team = array('id' => 'peronal-setting', 'title' => 'Personal settings', 'desc' => '', 'pages' => array('cp_team'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Team Featured', 'id' => $prefix . 'team_featured', 'std' => 'off', 'type' => 'on-off', 'desc' => 'Show this profile to show on front'), array('label' => 'Position', 'id' => $prefix . 'team_position', 'type' => 'text', 'desc' => 'Enter the team member\'s position within the team.')));
    // Gallery post type
    $post_type_gallery = array('id' => 'gallery-setting', 'title' => 'Upload photos', 'desc' => 'These settings enable you to upload photos.', 'pages' => array('cp_gallery'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Location', 'id' => $prefix . 'album_location', 'type' => 'text', 'desc' => 'Where this album take photos'), array('label' => 'Upload photo', 'id' => $prefix . 'gallery', 'type' => 'gallery', 'desc' => 'Upload photos'), array('label' => 'Photo columns', 'id' => $prefix . 'gallery_cols', 'type' => 'select', 'std' => '4', 'desc' => '', 'choices' => array(array('value' => '2', 'label' => '2', 'src' => ''), array('value' => '3', 'label' => '3', 'src' => ''), array('value' => '4', 'label' => '4', 'src' => ''), array('value' => '5', 'label' => '5', 'src' => '')))));
    /**
     *	Return meta box option base on page template selected
     */
    function rw_maybe_include()
    {
        // Include in back-end only
        if (!defined('WP_ADMIN') || !WP_ADMIN) {
            return false;
        }
        // Always include for ajax
        if (defined('DOING_AJAX') && DOING_AJAX) {
            return true;
        }
        if (isset($_GET['post'])) {
            $post_id = $_GET['post'];
        } elseif (isset($_POST['post_ID'])) {
            $post_id = $_POST['post_ID'];
        } else {
            $post_id = false;
        }
        $post_id = (int) $post_id;
        $post = get_post($post_id);
        $template = get_post_meta($post_id, '_wp_page_template', true);
        return $template;
    }
    //Register meta boxes
    ot_register_meta_box($post_format_video);
    ot_register_meta_box($post_format_audio);
    ot_register_meta_box($post_type_team);
    ot_register_meta_box($post_type_gallery);
    $template_file = rw_maybe_include();
    if ($template_file == 'page-templates/page-tv.php' || $template_file == 'page-templates/page-radio.php' || $template_file == 'page-templates/page-blog.php' || $template_file == 'page-templates/page-klahan9.php') {
        ot_register_meta_box($page_template_settings);
    }
    if ($template_file == 'page-templates/page-home.php') {
        ot_register_meta_box($page_home_template_settings);
    }
    if ($template_file == 'page-templates/page-tv.php') {
        ot_register_meta_box($page_tv_template_settings);
    }
    if ($template_file == 'page-templates/page-radio.php') {
        ot_register_meta_box($page_radio_template_settings);
    }
    if ($template_file == 'page-templates/page-monthly-topic.php') {
        ot_register_meta_box($radio_monthly_topic_template_settings);
    }
    ot_register_meta_box($page_layout_options);
}
示例#8
0
/**
 * Meta Boxes demo code.
 *
 * You can find all the available option types in demo-theme-options.php.
 *
 * @return    void
 * @since     2.0
 */
function custom_meta_boxes()
{
    $prefix = 'wpsp_';
    /*  Custom meta boxes
    	/* ------------------------------------ */
    $page_layout_options = array('id' => 'page-options', 'title' => 'Page Options', 'desc' => '', 'pages' => array('page', 'post', 'cp_tour'), 'context' => 'normal', 'priority' => 'default', 'fields' => array(array('label' => 'Primary Sidebar', 'id' => $prefix . 'sidebar_primary', 'type' => 'sidebar-select', 'desc' => 'Overrides default'), array('label' => 'Layout', 'id' => $prefix . 'layout', 'type' => 'radio-image', 'desc' => 'Overrides the default layout option', 'std' => 'inherit', 'choices' => array(array('value' => 'inherit', 'label' => 'Inherit Layout', 'src' => get_template_directory_uri() . '/assets/images/admin/layout-off.png'), array('value' => 'col-1c', 'label' => '1 Column', 'src' => get_template_directory_uri() . '/assets/images/admin/col-1c.png'), array('value' => 'col-2cl', 'label' => '2 Column Left', 'src' => get_template_directory_uri() . '/assets/images/admin/col-2cl.png'), array('value' => 'col-2cr', 'label' => '2 Column Right', 'src' => get_template_directory_uri() . '/assets/images/admin/col-2cr.png')))));
    /* ---------------------------------------------------------------------- */
    /*	Home template
    	/* ---------------------------------------------------------------------- */
    $home_template_settings = array('id' => 'homepage-settings', 'title' => 'Homepage Settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Slider', 'id' => 'tab_slider', 'type' => 'tab'), array('label' => 'Slider', 'id' => $prefix . 'category_slider', 'type' => 'taxonomy-select', 'std' => '', 'desc' => 'Select slide category to be show under header menu of this page. <br/><a href="' . get_admin_url() . 'edit.php?post_type=cp_slider" target="_blank">Manage Slider</a>', 'taxonomy' => 'slider'), array('label' => 'Best Offer', 'id' => 'tab_tour_offer', 'type' => 'tab'), array('label' => 'Heading title', 'id' => $prefix . 'heading_title', 'type' => 'text', 'std' => 'Special Offers Tours in Cambodia', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'heading_desc', 'type' => 'textarea_simple', 'std' => 'Explore best tours to visit some of our most popular destinations', 'desc' => '', 'rows' => '3'), array('label' => 'Tour style', 'id' => $prefix . 'tour_style', 'type' => 'taxonomy-select', 'std' => '', 'desc' => 'Select group of tour style, will be show on homepage', 'taxonomy' => 'tour_style'), array('label' => 'Amount of tours', 'id' => $prefix . 'tour_amount', 'type' => 'numeric-slider', 'min_max_step' => '1,18,1', 'std' => '', 'desc' => 'Set number of tour for this tour style. Between 1 and 6 tours'), array('label' => 'About Cambodia', 'id' => 'tab_about_cambodia', 'type' => 'tab'), array('label' => 'Heading title', 'id' => $prefix . 'cambodia_title', 'type' => 'text', 'std' => 'Welcome to Cambodia', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'cambodia_desc', 'type' => 'textarea_simple', 'std' => 'Cambodia is a country of charm and unique cultural heritage known across the globe for its incredible natural beauty, breathtaking temples, fertile rice paddy fields and a history past unlike any other. Should you decide to come and view the awe-inspiring temples of Angkor, you may find yourself transported into a world frozen in centuries past, which only comes to life in this special place. <strong>So where wil you go in Cambodia?</strong>', 'desc' => '', 'rows' => '5'), array('label' => 'Destinations 1', 'id' => $prefix . 'destination_1', 'type' => 'page_select', 'std' => '', 'desc' => 'Select destination you like to show under description.'), array('label' => 'Destinations 2', 'id' => $prefix . 'destination_2', 'type' => 'page_select', 'std' => '', 'desc' => 'Select destination you like to show under description.'), array('label' => 'Destinations 3', 'id' => $prefix . 'destination_3', 'type' => 'page_select', 'std' => '', 'desc' => 'Select destination you like to show under description.'), array('label' => 'Map', 'id' => $prefix . 'cambodia_map', 'type' => 'upload', 'std' => '', 'desc' => 'Optional: Upload map for this country. .jpg, .gif, .png'), array('label' => 'Map link', 'id' => $prefix . 'cambodia_map_link', 'type' => 'text', 'std' => '', 'desc' => 'Copy and past URL/link for the map'), array('label' => 'Button link', 'id' => $prefix . 'cambodia_btn_link', 'type' => 'text', 'std' => '', 'desc' => 'Copy and past URL/link for button'), array('label' => 'Tour design', 'id' => 'tab_tour_design', 'type' => 'tab'), array('label' => 'Heading title', 'id' => $prefix . 'tour_design_title', 'type' => 'text', 'std' => 'Create Your Own Dream Itinerary', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'tour_design_desc', 'type' => 'textarea_simple', 'std' => 'My Cambodia Travel can help you in three easy step to custom your tour in Cambodia', 'desc' => '', 'rows' => '3'), array('label' => 'Step 1', 'id' => $prefix . 'step_title_1', 'type' => 'text', 'std' => 'Your destination', 'desc' => 'Title of step 1'), array('id' => 'step_destinations', 'label' => 'Dstination photos', 'desc' => '', 'type' => 'list-item', 'choices' => array(), 'settings' => array(array('id' => 'thumbnail', 'label' => 'Upload destination photo', 'desc' => '', 'std' => '', 'type' => 'upload', 'choices' => array()))), array('label' => 'Step 2', 'id' => $prefix . 'step_title_2', 'type' => 'text', 'std' => 'Your mood', 'desc' => 'Title of step 2'), array('id' => 'step_mood', 'label' => 'Tour style photos', 'desc' => '', 'type' => 'list-item', 'choices' => array(), 'settings' => array(array('id' => 'thumbnail', 'label' => 'Upload photo', 'desc' => '', 'std' => '', 'type' => 'upload', 'choices' => array()))), array('label' => 'Step 3', 'id' => $prefix . 'step_title_3', 'type' => 'text', 'std' => 'Your detail', 'desc' => 'Title of step 3'), array('label' => 'Tour style', 'id' => 'tab_tour_style_icon', 'type' => 'tab'), array('label' => 'Heading title', 'id' => $prefix . 'style_title', 'type' => 'text', 'std' => 'Your Feeling and Tour Mood:', 'desc' => ''), array('label' => 'Description', 'id' => $prefix . 'style_desc', 'type' => 'textarea_simple', 'std' => 'Join with us to explore and experience the most notable destinations and valuable treasure of Cambodia', 'desc' => '', 'rows' => '3'), array('label' => 'Show/Hide empty tour style name', 'id' => $prefix . 'tour_hide_empty', 'type' => 'on-off', 'std' => 'on', 'desc' => 'Default: on - show tour sytle name if it does not have any tours')));
    /* ---------------------------------------------------------------------- */
    /*	Destination template
    	/* ---------------------------------------------------------------------- */
    $destination_template_settings = array('id' => 'destination-settings', 'title' => 'Destination Settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Map', 'id' => $prefix . 'embed_map', 'type' => 'text', 'std' => '', 'desc' => 'Copy embed map code from google map account'), array('label' => 'Tour by Destination', 'id' => $prefix . 'related_tour', 'type' => 'taxonomy-select', 'std' => '', 'desc' => 'Select destination name to show related tour', 'taxonomy' => 'tour_destination')));
    /* ---------------------------------------------------------------------- */
    /*	Attraction template
    	/* ---------------------------------------------------------------------- */
    $attraction_template_settings = array('id' => 'attraction-settings', 'title' => 'Attraction Settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Gallery', 'id' => $prefix . 'attraction_gallery', 'type' => 'custom-post-type-select', 'std' => '', 'desc' => 'Select album for this attraction. <br/><a href="' . get_admin_url() . 'edit.php?post_type=cp_gallery" target="_blank">Manage Gallery</a>', 'post_type' => 'cp_gallery'), array('label' => 'Map', 'id' => $prefix . 'embed_map', 'type' => 'text', 'std' => '', 'desc' => 'Copy embed map code from google map account'), array('label' => 'Tour by Destination', 'id' => $prefix . 'related_tour', 'type' => 'taxonomy-select', 'std' => '', 'desc' => 'Select destination name to show related tour', 'taxonomy' => 'tour_destination')));
    /* ---------------------------------------------------------------------- */
    /*	Post Type - Tour
    	/* ---------------------------------------------------------------------- */
    $post_type_tour = array('id' => 'tour-settings', 'title' => 'Tour SUMMARY', 'desc' => '', 'pages' => array('cp_tour'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Day', 'id' => 'tab_day', 'type' => 'tab'), array('label' => 'Amount of days', 'id' => $prefix . 'day_amount', 'type' => 'numeric-slider', 'min_max_step' => '1,30,1', 'std' => '', 'desc' => 'Set number of day for this tour'), array('label' => 'Price', 'id' => 'tab_price', 'type' => 'tab'), array('label' => 'Price', 'id' => $prefix . 'tour_price', 'type' => 'text', 'std' => '', 'desc' => 'Enter number only. e.g: 1840'), array('label' => 'Is promotion', 'id' => $prefix . 'is_promote', 'type' => 'on-off', 'std' => 'off', 'desc' => 'Switch discount options - on/off'), array('label' => 'Percentage of discount', 'id' => $prefix . 'discount_amount', 'type' => 'text', 'std' => '', 'desc' => 'Enter number only. e.g: 5, 10 or 30', 'condition' => 'wpsp_is_promote:is(on)'), array('label' => 'Available Date', 'id' => 'tab_date', 'type' => 'tab'), array('label' => 'Valid from', 'id' => $prefix . 'valid_from', 'type' => 'date-picker', 'std' => '', 'desc' => 'Tour Available star date'), array('label' => 'Valid end', 'id' => $prefix . 'valid_end', 'type' => 'date-picker', 'std' => '', 'desc' => 'Tour Available end date'), array('label' => 'Brochure', 'id' => 'tab_brochure', 'type' => 'tab'), array('label' => 'Brochure', 'id' => $prefix . 'brochure', 'type' => 'upload', 'std' => '', 'desc' => 'Optional: Upload brochure file for guest/customer download. .doc, .docx, .pdf'), array('label' => 'Highlight', 'id' => 'tab_highlight', 'type' => 'tab'), array('label' => 'Tour highlight', 'id' => $prefix . 'highlight', 'type' => 'textarea-simple', 'desc' => 'You can separate each days by comma(,) <br> e.g: Day 1: Arrive in Phnom Penh, <br>Day 2: Explore Phnom Penh', 'rows' => '4'), array('label' => 'Map', 'id' => 'tab_map', 'type' => 'tab'), array('label' => 'Map', 'id' => $prefix . 'embed_map', 'type' => 'text', 'std' => '', 'desc' => 'Copy embed map code from google map account')));
    /* ---------------------------------------------------------------------- */
    /*	Post Type - Tour - Slideshow
    	/* ---------------------------------------------------------------------- */
    $post_type_tour_slideshow = array('id' => 'tour-slideshow', 'title' => 'Tour Slideshow', 'desc' => '', 'pages' => array('cp_tour'), 'context' => 'normal', 'priority' => 'default', 'fields' => array(array('label' => 'Upload photos', 'id' => $prefix . 'tour_slideshow', 'type' => 'gallery', 'std' => '', 'desc' => 'Upload photos slideshow for this tour with supported file: .jpg, .gif and .png')));
    /* ---------------------------------------------------------------------- */
    /*	Post Type - Slider
    	/* ---------------------------------------------------------------------- */
    $post_type_slider = array('id' => 'slider-settings', 'title' => 'Slider Settings', 'desc' => '', 'pages' => array('cp_slider'), 'context' => 'normal', 'priority' => 'default', 'fields' => array(array('label' => 'Button text', 'id' => $prefix . 'slider_btn', 'type' => 'text', 'std' => 'Discover Now', 'desc' => ''), array('label' => 'Link', 'id' => $prefix . 'slider_link', 'type' => 'text', 'std' => '', 'desc' => ''), array('label' => 'Upload photos', 'id' => $prefix . 'slider_image', 'type' => 'upload', 'std' => '', 'desc' => 'Upload photos slideshow with support file: .jpg, .gif, .png')));
    // Gallery post type
    $post_type_gallery = array('id' => 'gallery-settings', 'title' => 'Upload photos', 'desc' => 'These settings enable you to upload photos.', 'pages' => array('cp_gallery'), 'context' => 'normal', 'priority' => 'default', 'fields' => array(array('label' => 'Upload photo', 'id' => $prefix . 'gallery', 'type' => 'gallery', 'desc' => 'Upload photos')));
    /* ---------------------------------------------------------------------- */
    /*	Return meta box option base on page template selected
    	/* ---------------------------------------------------------------------- */
    function rw_maybe_include()
    {
        // Include in back-end only
        if (!defined('WP_ADMIN') || !WP_ADMIN) {
            return false;
        }
        // Always include for ajax
        if (defined('DOING_AJAX') && DOING_AJAX) {
            return true;
        }
        if (isset($_GET['post'])) {
            $post_id = $_GET['post'];
        } elseif (isset($_POST['post_ID'])) {
            $post_id = $_POST['post_ID'];
        } else {
            $post_id = false;
        }
        $post_id = (int) $post_id;
        $post = get_post($post_id);
        $template = get_post_meta($post_id, '_wp_page_template', true);
        return $template;
    }
    /**
     * Register our meta boxes using the 
     * ot_register_meta_box() function.
     */
    if (function_exists('ot_register_meta_box')) {
        ot_register_meta_box($post_type_tour);
        ot_register_meta_box($post_type_tour_slideshow);
        ot_register_meta_box($post_type_slider);
        ot_register_meta_box($post_type_gallery);
        $template_file = rw_maybe_include();
        if ($template_file == 'templates/page-destination.php') {
            ot_register_meta_box($destination_template_settings);
        }
        if ($template_file == 'templates/page-attraction.php') {
            ot_register_meta_box($attraction_template_settings);
        }
        if ($template_file == 'templates/page-home.php') {
            ot_register_meta_box($home_template_settings);
        }
        ot_register_meta_box($page_layout_options);
    }
}
示例#9
0
function _custom_meta_boxes()
{
    $prefix = 'sp_';
    /*  Custom meta boxes
    /* ------------------------------------ */
    $page_options = array('id' => 'page-options', 'title' => 'Page Options', 'desc' => '', 'pages' => array('page', 'post', 'team', 'gallery'), 'context' => 'normal', 'priority' => 'default', 'fields' => array(array('label' => 'Primary Sidebar', 'id' => $prefix . 'sidebar_primary', 'type' => 'sidebar-select', 'desc' => 'Overrides default'), array('label' => 'Layout', 'id' => $prefix . 'layout', 'type' => 'radio-image', 'desc' => 'Overrides the default layout option', 'std' => 'inherit', 'choices' => array(array('value' => 'inherit', 'label' => 'Inherit Layout', 'src' => SP_ASSETS_ADMIN . 'images/layout-off.png'), array('value' => 'col-1c', 'label' => '1 Column', 'src' => SP_ASSETS_ADMIN . 'images/col-1c.png'), array('value' => 'col-2cl', 'label' => '2 Column Left', 'src' => SP_ASSETS_ADMIN . 'images/col-2cl.png'), array('value' => 'col-2cr', 'label' => '2 Column Right', 'src' => SP_ASSETS_ADMIN . 'images/col-2cr.png')))));
    /*$post_options = array(
    	'id'          => 'post-options',
    	'title'       => 'Post Options',
    	'desc'        => '',
    	'pages'       => array( 'post' ),
    	'context'     => 'normal',
    	'priority'    => 'high',
    	'fields'      => array(
    		array(
    			'label'		=> 'Primary Sidebar',
    			'id'		=> $prefix . 'sidebar_primary',
    			'type'		=> 'sidebar-select',
    			'desc'		=> 'Overrides default'
    		),
    		array(
    			'label'		=> 'Layout',
    			'id'		=> $prefix . 'layout',
    			'type'		=> 'radio-image',
    			'desc'		=> 'Overrides the default layout option',
    			'std'		=> 'inherit',
    			'choices'	=> array(
    				array(
    					'value'		=> 'inherit',
    					'label'		=> 'Inherit Layout',
    					'src'		=> SP_ASSETS_ADMIN . 'images/layout-off.png'
    				),
    				array(
    					'value'		=> 'col-1c',
    					'label'		=> '1 Column',
    					'src'		=> SP_ASSETS_ADMIN . 'images/col-1c.png'
    				),
    				array(
    					'value'		=> 'col-2cl',
    					'label'		=> '2 Column Left',
    					'src'		=> SP_ASSETS_ADMIN . 'images/col-2cl.png'
    				),
    				array(
    					'value'		=> 'col-2cr',
    					'label'		=> '2 Column Right',
    					'src'		=> SP_ASSETS_ADMIN . 'images/col-2cr.png'
    				)
    			)
    		)
    	)
    );*/
    /* ---------------------------------------------------------------------- */
    /*	Home Sliders post type
    /* ---------------------------------------------------------------------- */
    $post_type_home_sliders = array('id' => 'home-slide-setting', 'title' => 'Home slide meta', 'desc' => '', 'pages' => array('home_slider'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Link button', 'id' => $prefix . 'slide_btn_name', 'type' => 'text', 'std' => 'Explore', 'desc' => 'Name of button link'), array('label' => 'Slide URL/Link', 'id' => $prefix . 'slide_btn_url', 'type' => 'text', 'std' => '#', 'desc' => 'Enter slide URL')));
    /* ---------------------------------------------------------------------- */
    /*	Testimonial post type
    /* ---------------------------------------------------------------------- */
    $post_type_testimonial = array('id' => 'testimonial-setting', 'title' => 'Testimonial meta', 'desc' => '', 'pages' => array('testimonial'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Nationality', 'id' => $prefix . 'testimonial_cite', 'type' => 'text', 'desc' => 'Enter the country name of the testimonial.'), array('label' => 'Testimonial Cite Subtext', 'id' => $prefix . 'testimonial_cite_subtext', 'type' => 'text', 'desc' => 'Enter living action of this guest (optional).')));
    /* ---------------------------------------------------------------------- */
    /*	Gallery post type
    /* ---------------------------------------------------------------------- */
    $post_type_gallery = array('id' => 'gallery-setting', 'title' => 'Upload photos', 'desc' => 'These settings enable you to upload photos.', 'pages' => array('gallery'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Upload photo', 'id' => $prefix . 'gallery', 'type' => 'gallery', 'desc' => 'Upload photos')));
    /* ---------------------------------------------------------------------- */
    /*	Slider post type
    /* ---------------------------------------------------------------------- */
    $post_type_slider = array('id' => 'gallery-setting', 'title' => 'Upload photos', 'desc' => 'These settings enable you to upload photos.', 'pages' => array('slider', 'facility', 'room'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Upload photo', 'id' => $prefix . 'sliders', 'type' => 'gallery', 'desc' => 'Upload photos')));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: video
    /* ---------------------------------------------------------------------- */
    $post_format_video = array('id' => 'format-video', 'title' => 'Format: Video', 'desc' => 'These settings enable you to embed videos into your posts.', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Video URL', 'id' => $prefix . 'video_url', 'type' => 'text', 'desc' => 'Recommended to use.'), array('label' => 'Video Embed Code', 'id' => $prefix . 'video_embed_code', 'type' => 'textarea', 'rows' => '2')));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: Audio
    /* ---------------------------------------------------------------------- */
    $post_format_audio = array('id' => 'format-audio', 'title' => 'Format: Audio', 'desc' => 'These settings enable you to embed audio into your posts. You must provide both .mp3 and .ogg/.oga file formats in order for self hosted audio to function accross all browsers.', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'MP3 File URL', 'id' => $prefix . 'audio_mp3_url', 'type' => 'upload', 'desc' => 'The URL to the .mp3 or .m4a audio file'), array('label' => 'OGA File URL', 'id' => $prefix . 'audio_ogg_url', 'type' => 'upload', 'desc' => 'The URL to the .oga, .ogg audio file')));
    /* ---------------------------------------------------------------------- */
    /*	Post Format: Gallery
    /* ---------------------------------------------------------------------- */
    $post_format_gallery = array('id' => 'format-gallery', 'title' => 'Format: Gallery', 'desc' => 'Standard post galleries.</i>', 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Upload photo', 'id' => $prefix . 'post_gallery', 'type' => 'gallery', 'desc' => 'Upload photos')));
    /* ---------------------------------------------------------------------- */
    /*	Metabox for Home template
    /* ---------------------------------------------------------------------- */
    $page_template_home = array('id' => 'home-settings', 'title' => 'Home settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Slideshow', 'id' => $prefix . 'slide_options', 'type' => 'tab'), array('label' => 'Number of Slide to show', 'id' => $prefix . 'slide_num', 'type' => 'text', 'std' => '5', 'desc' => 'Enter number of slide e.g. 5'), array('label' => 'Slide URL/Link', 'id' => $prefix . 'slide_btn_url', 'type' => 'text', 'std' => '#', 'desc' => 'Enter slide URL'), array('label' => 'Message', 'id' => $prefix . 'welcome_options', 'type' => 'tab'), array('label' => 'Description', 'id' => $prefix . 'welcome_msg', 'type' => 'textarea', 'rows' => '2', 'std' => ''), array('label' => 'Facilities', 'id' => $prefix . 'facility_options', 'type' => 'tab'), array('label' => 'Number of Facilities to show', 'id' => $prefix . 'facility_num', 'type' => 'text', 'std' => '-1', 'desc' => 'Enter number of service e.g. 5'), array('label' => 'Testimonial', 'id' => $prefix . 'testimonial_options', 'type' => 'tab'), array('label' => 'More testimonial text', 'id' => $prefix . 'more_guest_txt', 'type' => 'text', 'std' => 'More guests'), array('label' => 'Testimonial page', 'id' => $prefix . 'testimonial_page_id', 'type' => 'page-select')));
    /* ---------------------------------------------------------------------- */
    /*	Metabox for Contact template
    /* ---------------------------------------------------------------------- */
    $page_template_contact = array('id' => 'contact-settings', 'title' => 'contact settings', 'desc' => '', 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Latitude and Longitude of a Point', 'id' => $prefix . 'contact_map', 'type' => 'text', 'desc' => 'You can get latitude and longitude coordinates of a point from <a href="http://itouchmap.com/latlong.html" target="_blank">Itouchmap</a>', 'std' => '11.555509,104.926082')));
    function rw_maybe_include()
    {
        // Include in back-end only
        if (!defined('WP_ADMIN') || !WP_ADMIN) {
            return false;
        }
        // Always include for ajax
        if (defined('DOING_AJAX') && DOING_AJAX) {
            return true;
        }
        if (isset($_GET['post'])) {
            $post_id = $_GET['post'];
        } elseif (isset($_POST['post_ID'])) {
            $post_id = $_POST['post_ID'];
        } else {
            $post_id = false;
        }
        $post_id = (int) $post_id;
        $post = get_post($post_id);
        $template = get_post_meta($post_id, '_wp_page_template', true);
        return $template;
    }
    /*  Register meta boxes
    /* ------------------------------------ */
    ot_register_meta_box($page_options);
    ot_register_meta_box($post_format_audio);
    ot_register_meta_box($post_format_gallery);
    ot_register_meta_box($post_format_video);
    // ot_register_meta_box( $post_options );
    ot_register_meta_box($post_type_home_sliders);
    ot_register_meta_box($post_type_testimonial);
    ot_register_meta_box($post_type_gallery);
    ot_register_meta_box($post_type_slider);
    $template_file = rw_maybe_include();
    if ($template_file == 'template-home.php') {
        ot_register_meta_box($page_template_home);
    }
    if ($template_file == 'template-contact.php') {
        ot_register_meta_box($page_template_contact);
    }
}