Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Adds METABOX hide and show
- **/
- add_filter( 'rwmb_meta_boxes', 'sage_register_meta_boxes' );
- /**
- * Register meta boxes
- *
- * @param array $meta_boxes
- *
- * @return array
- */
- function sage_register_meta_boxes( $meta_boxes ) {
- $prefix = 'rw_';
- //Home Metaboxes
- $meta_boxes[] = array(
- 'title' => 'Template - Home',
- 'pages' => array( 'page' ),
- // Show this meta box for posts matched below conditions
- 'show' => array(
- // With all conditions below, use this logical operator to combine them. Default is 'OR'. Case insensitive. Optional.
- 'relation' => 'OR',
- // List of page templates (used for page only). Array. Optional.
- 'template' => array( 'page-home.php' ),
- // List of post formats. Array. Case insensitive. Optional.
- 'post_format' => array(),
- // List of categories IDs or names (NOT slugs). Array. Case sensitive. Optional.
- 'category' => array(),
- // Custom taxonomy. Optional.
- // Format: 'taxonomy' => list of term IDs or names (NOT slugs). Array. Case sensitive. Optional.
- 'location' => array(),
- 'os' => array(),
- // Check if page is a child page
- 'is_child' => true
- ),
- 'fields' => array(
- //Fields are broken into groups below
- array(
- 'name' => 'Hero',
- 'id' => 'home__hero',
- 'type' => 'group',
- //List of fields
- 'fields' => array(
- array(
- 'name' => __( 'H4', 'textdomain' ),
- 'id' => $prefix . 'hometemp-hero-h4',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'H1', 'textdomain' ),
- 'id' => $prefix . 'hometemp-hero-h1',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'Paragraph', 'textdomain' ),
- 'id' => $prefix . 'hometemp-hero-p',
- 'type' => 'textarea',
- ),
- array(
- 'name' => __( 'Button URL', 'textdomain' ),
- 'id' => $prefix . 'hometemp-hero-btn-url',
- 'type' => 'url',
- ),
- array(
- 'name' => __( 'Background URL (≥1200px)', 'textdomain' ),
- 'id' => $prefix . 'hometemp-hero-bg-1200',
- 'type' => 'file_advanced',
- ),
- array(
- 'name' => __( 'Background URL (<768px)', 'textdomain' ),
- 'id' => $prefix . 'hometemp-hero-bg-768',
- 'type' => 'file_advanced',
- ),
- ),
- ),
- array(
- 'name' => 'Offerings',
- 'id' => 'home__offering',
- 'type' => 'group',
- //List of fields
- 'fields' => array(
- array(
- 'name' => __( 'H2', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-h2',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'Paragraph', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-p',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'Box 1 Icon', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b1icon',
- 'type' => 'file_advanced',
- ),
- array(
- 'name' => __( 'Box 1 H4', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b1h4',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'Box 1 URL', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b1url',
- 'type' => 'url',
- ),
- array(
- 'name' => __( 'Box 1 Paragraph', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b1p',
- 'type' => 'textarea',
- ),
- array(
- 'name' => __( 'Box 2 Icon', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b2icon',
- 'type' => 'file_advanced',
- ),
- array(
- 'name' => __( 'Box 2 H4', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b2h4',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'Box 2 URL', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b2url',
- 'type' => 'url',
- ),
- array(
- 'name' => __( 'Box 2 Paragraph', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b2p',
- 'type' => 'textarea',
- ),
- array(
- 'name' => __( 'Box 3 Icon', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b3icon',
- 'type' => 'file_advanced',
- ),
- array(
- 'name' => __( 'Box 3 H4', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b3h4',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'Box 3 URL', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b3url',
- 'type' => 'url',
- ),
- array(
- 'name' => __( 'Box 3 Paragraph', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b3p',
- 'type' => 'textarea',
- ),
- array(
- 'name' => __( 'Box 4 Icon', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b4icon',
- 'type' => 'file_advanced',
- ),
- array(
- 'name' => __( 'Box 4 H4', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b4h4',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'Box 4 URL', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b4url',
- 'type' => 'url',
- ),
- array(
- 'name' => __( 'Box 4 Paragraph', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b4p',
- 'type' => 'textarea',
- ),
- ),
- ),
- array(
- 'name' => 'Featured Insights',
- 'id' => 'home__finsights',
- 'type' => 'group',
- //List of fields
- 'fields' => array(
- array(
- 'name' => __( 'Featured Insight #1', 'sage_' ),
- 'id' => $prefix . 'hometemp-feat1',
- 'type' => 'post',
- // 'clone' => true,
- // 'multiple' => true,
- // Post type: string (for single post type) or array (for multiple post types)
- 'post_type' => array( 'post', 'media-assets' ),
- // Default selected value (post ID)
- 'std' => 1,
- // Field type, either 'select' or 'select_advanced' (default)
- 'field_type' => 'select_advanced',
- // Placeholder
- 'placeholder' => __( 'Select An Article', 'sage_' ),
- // Query arguments (optional). No settings means get all published posts
- // @see https://codex.wordpress.org/Class_Reference/WP_Query
- 'query_args' => array(
- 'post_status' => 'publish',
- 'posts_per_page' => - 1,
- ),
- ),
- array(
- 'name' => __( 'Featured Insight #2', 'sage_' ),
- 'id' => $prefix . 'hometemp-feat2',
- 'type' => 'post',
- // 'clone' => true,
- // 'multiple' => true,
- // Post type: string (for single post type) or array (for multiple post types)
- 'post_type' => array( 'post', 'media-assets' ),
- // Default selected value (post ID)
- 'std' => 1,
- // Field type, either 'select' or 'select_advanced' (default)
- 'field_type' => 'select_advanced',
- // Placeholder
- 'placeholder' => __( 'Select An Article', 'sage_' ),
- // Query arguments (optional). No settings means get all published posts
- // @see https://codex.wordpress.org/Class_Reference/WP_Query
- 'query_args' => array(
- 'post_status' => 'publish',
- 'posts_per_page' => - 1,
- ),
- ),
- ),
- ),
- array(
- 'name' => 'Featured Video',
- 'id' => 'home__fvideo',
- 'type' => 'group',
- //List of fields
- 'fields' => array(
- array(
- 'id' => $prefix . 'hometemp-fvideo',
- 'name' => __( 'Video Embed', 'sage_' ),
- 'type' => 'oembed',
- // Allow to clone? Default is false
- 'clone' => false,
- // Input size
- 'size' => 30,
- ),
- array(
- 'name' => __( 'H4', 'textdomain' ),
- 'id' => $prefix . 'hometemp-fvideo-b4h4',
- 'type' => 'text',
- ),
- array(
- 'name' => __( 'Paragraph', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b4p',
- 'type' => 'textarea',
- ),
- array(
- 'name' => __( 'Button URL', 'textdomain' ),
- 'id' => $prefix . 'hometemp-offering-b4url',
- 'type' => 'url',
- ),
- ),
- ),
- ),
- );
- return $meta_boxes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement