Viewing File: /home/maglabs/2vsa/wp-content/themes/cargohub/inc/backend/meta-boxes.php
<?php
/**
* Registering meta boxes
*
* All the definitions of meta boxes are listed below with comments.
*
* For more information, please visit:
* @link http://www.deluxeblogtips.com/meta-box/
*/
/**
* Enqueue script for handling actions with meta boxes
*
* @since 1.0
*
* @param string $hook
*/
function cargohub_meta_box_scripts( $hook ) {
// Detect to load un-minify scripts when WP_DEBUG is enable
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
wp_enqueue_script( 'cargohub-meta-boxes', get_template_directory_uri() . "/js/backend/meta-boxes$min.js", array( 'jquery' ), '20161025', true );
}
}
add_action( 'admin_enqueue_scripts', 'cargohub_meta_box_scripts' );
/**
* Registering meta boxes
*
* Using Meta Box plugin: http://www.deluxeblogtips.com/meta-box/
*
* @see http://www.deluxeblogtips.com/meta-box/docs/define-meta-boxes
*
* @param array $meta_boxes Default meta boxes. By default, there are no meta boxes.
*
* @return array All registered meta boxes
*/
function cargohub_register_meta_boxes( $meta_boxes ) {
// Post format's meta box
$meta_boxes[] = array(
'id' => 'post-format-settings',
'title' => esc_html__( 'Format Details', 'cargohub' ),
'pages' => array( 'post' ),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
'fields' => array(
array(
'name' => esc_html__( 'Image', 'cargohub' ),
'id' => 'image',
'type' => 'image_advanced',
'class' => 'image',
'max_file_uploads' => 1,
),
array(
'name' => esc_html__( 'Gallery', 'cargohub' ),
'id' => 'images',
'type' => 'image_advanced',
'class' => 'gallery',
),
array(
'name' => esc_html__( 'Audio', 'cargohub' ),
'id' => 'audio',
'type' => 'textarea',
'cols' => 20,
'rows' => 2,
'class' => 'audio',
),
array(
'name' => esc_html__( 'Video', 'cargohub' ),
'id' => 'video',
'type' => 'textarea',
'cols' => 20,
'rows' => 2,
'class' => 'video',
),
array(
'name' => esc_html__( 'Link', 'cargohub' ),
'id' => 'url',
'type' => 'textarea',
'cols' => 20,
'rows' => 1,
'class' => 'link',
),
array(
'name' => esc_html__( 'Text', 'cargohub' ),
'id' => 'url_text',
'type' => 'textarea',
'cols' => 20,
'rows' => 1,
'class' => 'link',
),
array(
'name' => esc_html__( 'Quote', 'cargohub' ),
'id' => 'quote',
'type' => 'textarea',
'cols' => 20,
'rows' => 2,
'class' => 'quote',
),
array(
'name' => esc_html__( 'Author', 'cargohub' ),
'id' => 'quote_author',
'type' => 'textarea',
'cols' => 20,
'rows' => 1,
'class' => 'quote',
),
array(
'name' => esc_html__( 'Author URL', 'cargohub' ),
'id' => 'author_url',
'type' => 'textarea',
'cols' => 20,
'rows' => 1,
'class' => 'quote',
),
array(
'name' => esc_html__( 'Status', 'cargohub' ),
'id' => 'status',
'type' => 'textarea',
'cols' => 20,
'rows' => 1,
'class' => 'status',
),
),
);
// Display Settings
$meta_boxes[] = array(
'id' => 'display-settings',
'title' => esc_html__( 'Display Settings', 'cargohub' ),
'pages' => array( 'page', 'service', 'project' ),
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'name' => esc_html__( 'Page Header', 'cargohub' ),
'id' => 'heading_page_header',
'type' => 'heading',
'class' => 'hide-homepage',
),
array(
'name' => esc_html__( 'Hide Page Header', 'cargohub' ),
'id' => 'hide_page_header',
'type' => 'checkbox',
'std' => false,
'class' => 'hide-homepage',
),
array(
'name' => esc_html__( 'Hide Title of Page Header', 'cargohub' ),
'id' => 'hide_title_page_header',
'type' => 'checkbox',
'std' => false,
'class' => 'hide-homepage',
),
array(
'name' => esc_html__( 'Page Header Image', 'cargohub' ),
'id' => 'title_area_bg',
'type' => 'image_advanced',
'max_file_uploads' => 1,
'class' => 'bg-title-area hide-homepage',
),
array(
'name' => esc_html__( 'Breadcrumb', 'cargohub' ),
'id' => 'heading_breadcrumb',
'type' => 'heading',
'class' => 'hide-homepage',
),
array(
'name' => esc_html__( 'Hide Breadcrumb', 'cargohub' ),
'id' => 'hide_breadcrumb',
'type' => 'checkbox',
'std' => false,
'class' => 'hide-homepage',
),
array(
'name' => esc_html__( 'Layout', 'cargohub' ),
'id' => 'heading_layout',
'type' => 'heading',
),
array(
'name' => esc_html__( 'Custom Layout', 'cargohub' ),
'id' => 'custom_layout',
'type' => 'checkbox',
'std' => false,
),
array(
'name' => esc_html__( 'Layout', 'cargohub' ),
'id' => 'layout',
'type' => 'image_select',
'class' => 'custom-layout',
'options' => array(
'no-sidebar' => get_template_directory_uri() . '/img/sidebars/empty.png',
'single-left' => get_template_directory_uri() . '/img/sidebars/single-left.png',
'single-right' => get_template_directory_uri() . '/img/sidebars/single-right.png',
),
),
),
);
$meta_boxes[] = array(
'id' => 'project-info',
'title' => esc_html__( 'Project Info', 'cargohub' ),
'pages' => array( 'project' ),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
'fields' => array(
array(
'name' => esc_html__( 'Gallery', 'cargohub' ),
'id' => 'images',
'type' => 'image_advanced',
'class' => 'gallery',
),
array(
'name' => esc_html__( 'Client', 'cargohub' ),
'id' => 'client',
'type' => 'text',
'class' => 'client',
),
array(
'name' => esc_html__( 'Website', 'cargohub' ),
'id' => 'website',
'type' => 'text',
'class' => 'website',
),
array(
'name' => esc_html__( 'Rating', 'cargohub' ),
'id' => 'rating',
'type' => 'slider',
'js_options' => array(
'min' => 0,
'max' => 10,
'step' => 1,
),
),
),
);
$meta_boxes[] = array(
'id' => 'testimonial_general',
'title' => esc_html__( 'General', 'cargohub' ),
'pages' => array( 'testimonial' ),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
'fields' => array(
array(
'name' => esc_html__( 'Star Rating', 'cargohub' ),
'id' => 'testi_star',
'type' => 'slider',
'js_options' => array(
'min' => 0,
'max' => 5,
'step' => 0.5,
),
),
array(
'name' => esc_html__( 'Job', 'cargohub' ),
'id' => 'testi_job',
'type' => 'textarea',
'std' => false,
),
)
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'cargohub_register_meta_boxes' );
function cargohub_notice__success() {
if ( ! function_exists('cargohub_vc_addons_init') ) {
return;
}
$versions = get_plugin_data( WP_PLUGIN_DIR . '/cargohub-vc-addons/cargohub-vc-addon.php' );
if ( version_compare( $versions['Version'], '1.1.0', '>=' ) ) {
return;
}
?>
<div class="notice notice-info is-dismissible">
<p><strong><?php esc_html_e( 'The CargoHub Visual Composer Addons plugin needs to be updated to 1.1 to ensure maximum compatibility with this theme. If you do not update it, your widgets will be lost.', 'cargohub' ); ?></strong></p>
</div>
<?php
}
add_action( 'admin_notices', 'cargohub_notice__success' );
Back to Directory
File Manager