Skip to content

Instantly share code, notes, and snippets.

@dovy
Created May 23, 2014 21:36
Show Gist options
  • Save dovy/a278b31d2a9190718b04 to your computer and use it in GitHub Desktop.
Save dovy/a278b31d2a9190718b04 to your computer and use it in GitHub Desktop.
<?php
if ( !function_exists( "redux_add_metaboxes" ) ):
function redux_add_metaboxes($metaboxes) {
$boxSections = array();
$boxSections[] = array(
'title' => __('Colors', 'redux-framework-demo'),
'icon' => 'el-icon-home',
'fields' => array(
array(
'id' => 'hero_color_info',
'type' => 'info',
'title' => __('No Color Options', 'redux-framework-demo'),
'subtitle' => __('Because you have selected Revolution Slider as the content of this page, there is no need for a color items.', 'redux-framework-demo'),
'notice' => true,
'style' => 'info',
'required' => array(
array( 'section_type', '=', 'revslider' ),
),
),
array(
'id' => 'hero_icon_color',
'type' => 'color',
'transparent' => false,
'default' => '#ffffff',
//'required' => array('hero_elements', '=', 'icon'),
'title' => __('Icon Color', 'redux-framework-demo'),
//'subtitle' => __('Optional: Set a custom color for the title text.', 'redux-framework-demo'),
'required' => array(
array( 'hero_elements', '=', 'icon' ),
),
),
array(
'id' => 'hero_icon_background_border_color',
'type' => 'color',
'default' => '#ffffff',
'transparent' => false,
'title' => __('Icon Background & Border Color', 'redux-framework-demo'),
//'subtitle' => __('Optional: Set a custom color for the title text.', 'redux-framework-demo'),
'required' => array(
array( 'section_type', 'not', 'revslider' ),
array( 'section_type', 'not', 'custom' ),
),
),
array(
'id' => 'hero_title_color',
'type' => 'color',
'transparent' => false,
'title' => __('Title Color', 'redux-framework-demo'),
'subtitle' => __('Optional: Set a custom color for the title text.', 'redux-framework-demo'),
'required' => array(
array( 'section_type', 'not', 'revslider' ),
array( 'section_type', 'not', 'custom' ),
),
),
array(
'id' => 'hero_subtitle_color',
'type' => 'color',
'transparent' => false,
'title' => __('Subtitle Color', 'redux-framework-demo'),
'subtitle' => __('Optional: Set a custom color for the title text.', 'redux-framework-demo'),
'required' => array(
array( 'section_type', 'not', 'revslider' ),
array( 'section_type', 'not', 'custom' ),
),
'output' => '.hero-subtitle',
),
),
);
$metaboxes[] = array(
'id' => 'page-type',
'title' => __('Section Settings', 'redux-framework-demo'),
'post_types' => array('page', 'post'),
//'page_template' => array('page-test.php'),
//'post_format' => array('image'),
'position' => 'normal', // normal, advanced, side
'priority' => 'high', // high, core, default, low
'sections' => $boxSections
);
// Kind of overkill, but ahh well. ;)
//$metaboxes = apply_filters( 'your_custom_redux_metabox_filter_here', $metaboxes );
return $metaboxes;
}
add_action('redux/metaboxes/redux_demo/boxes', 'redux_add_metaboxes');
endif;
require_once(dirname(__FILE__).'/loader.php');
@imranhoshain
Copy link

Its not working!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment