Skip to content

Instantly share code, notes, and snippets.

@aijazsiddique
Last active March 25, 2018 02:15
Show Gist options
  • Save aijazsiddique/48bf95eb4ec3b624d770 to your computer and use it in GitHub Desktop.
Save aijazsiddique/48bf95eb4ec3b624d770 to your computer and use it in GitHub Desktop.
config.php
<?php
// INCLUDE THIS BEFORE you load your ReduxFramework object config file.
// You may replace $redux_opt_name with a string if you wish. If you do so, change loader.php
// as well as all the instances below.
//$redux_opt_name = "redux_demo";
// No real configuration is needed for shortcodes. Simply run the loader with your opt_name set.
// The loader will load all of the extensions automatically based on your $redux_opt_name
//require_once(dirname(__FILE__).'/loader.php');
$redux_opt_name = "at_option";
if ( !function_exists( "redux_add_metaboxes" ) ):
function redux_add_metaboxes($metaboxes) {
// ID prefix
$prefix = 'at_option_';
// Define arrays
$metaboxes = array();
/**
Page Options
**/
$boxSections[] = array(
'title' => __('Home Settings', 'at-option'),
'desc' => __('Redux Framework was created with the developer in mind. It allows for any theme developer to have an advanced theme panel with most of the features a developer would need. For more information check out the Github repo at: <a href="https://github.com/ReduxFramework/Redux-Framework">https://github.com/ReduxFramework/Redux-Framework</a>', 'at-option'),
'icon' => 'el-icon-home',
'fields' => array(
array(
'id' => 'main_layout',
'type' => 'text',
'title' => __('Main Layout', 'at-option'),
'compiler' => 'false',
'desc'=> __('Slider Shortcode.', 'at-option'),
'subtitle' => __('Upload any media using the WordPress native uploader', 'at-option'),
),
array(
'id'=>'webFonts',
'type' => 'media',
'title' => __('Web Fonts', 'at-option'),
'compiler' => 'true',
'mode' => false, // Can be set to false to allow any media type, or can also be set to any mime type.
'desc'=> __('Basic media uploader with disabled URL input field.', 'at-option'),
'subtitle' => __('Upload any media using the WordPress native uploader', 'at-option'),
),
array(
'id'=>'section-media-start',
'type' => 'section',
'title' => __('Media Options', 'at-option'),
'subtitle'=> __('With the "section" field you can create indent option sections.'),
'indent' => true // Indent all options below until the next 'section' option is set.
),
array(
'id'=>'media',
'type' => 'media',
'url'=> true,
'title' => __('Media w/ URL', 'at-option'),
'compiler' => 'true',
//'mode' => false, // Can be set to false to allow any media type, or can also be set to any mime type.
'desc'=> __('Basic media uploader with disabled URL input field.', 'at-option'),
'subtitle' => __('Upload any media using the WordPress native uploader', 'at-option'),
'default'=>array('url'=>'http://s.wordpress.org/style/images/codeispoetry.png'),
),
array(
'id'=>'section-media-end',
'type' => 'section',
'indent' => false // Indent all options below until the next 'section' option is set.
),
array(
'id'=>'media-nourl',
'type' => 'media',
'title' => __('Media w/o URL', 'at-option'),
'desc'=> __('This represents the minimalistic view. It does not have the preview box or the display URL in an input box. ', 'at-option'),
'subtitle' => __('Upload any media using the WordPress native uploader', 'at-option'),
),
array(
'id'=>'media-nopreview',
'type' => 'media',
'preview'=> false,
'title' => __('Media No Preview', 'at-option'),
'desc'=> __('This represents the minimalistic view. It does not have the preview box or the display URL in an input box. ', 'at-option'),
'subtitle' => __('Upload any media using the WordPress native uploader', 'at-option'),
),
array(
'id' => 'gallery',
'type' => 'gallery',
'title' => __('Add/Edit Gallery', 'so-panels'),
'subtitle' => __('Create a new Gallery by selecting existing or uploading new images using the WordPress native uploader', 'so-panels'),
'desc' => __('This is the description field, again good for additional info.', 'at-option'),
),
array(
'id'=>'slider1bDOVY23',
'type' => 'slider',
'title' => __('JQuery UI Slider Example 1', 'at-option'),
'desc'=> __('JQuery UI slider description. Min: 1, max: 500, step: 3, default value: 45', 'at-option'),
"default" => "45",
"min" => "1",
"step" => "3",
"max" => "500",
),
array(
'id'=>'slider2bc',
'type' => 'slider',
'title' => __('JQuery UI Slider Example 2 w/ Steps (5)', 'at-option'),
'desc'=> __('JQuery UI slider description. Min: 0, max: 300, step: 5, default value: 75', 'at-option'),
"default" => "0",
"min" => "0",
"step" => "5",
"max" => "300",
),
array(
'id'=>'spinner1bcd',
'type' => 'spinner',
'title' => __('JQuery UI Spinner Example 1', 'at-option'),
'desc'=> __('JQuery UI spinner description. Min:20, max: 100, step:20, default value: 40', 'at-option'),
"default" => "40",
"min" => "20",
"step" => "20",
"max" => "100",
),
array(
'id'=>'switch-on',
'type' => 'switch',
'title' => __('Switch On', 'at-option'),
'subtitle'=> __('Look, it\'s on!', 'at-option'),
"default" => 1,
),
array(
'id'=>'switch-off',
'type' => 'switch',
'title' => __('Switch Off', 'at-option'),
'subtitle'=> __('Look, it\'s on!', 'at-option'),
"default" => 0,
),
)
);
$boxSections[] = array(
'title' => __('Home Layout', 'at-option'),
//'desc' => __('Redux Framework was created with the developer in mind. It allows for any theme developer to have an advanced theme panel with most of the features a developer would need. For more information check out the Github repo at: <a href="https://github.com/ReduxFramework/Redux-Framework">https://github.com/ReduxFramework/Redux-Framework</a>', 'at-option'),
'icon' => 'el-icon-home',
'fields' => array(
array(
"id" => "homepage_blocks",
"type" => "sorter",
"title" => "Homepage Layout Manager",
"desc" => "Organize how you want the layout to appear on the homepage",
"compiler"=>'true',
'required' => array('layout','=','1'),
'options' => array(
"enabled" => array(
"placebo" => "placebo", //REQUIRED!
"highlights" => "Highlights",
"slider" => "Slider",
"staticpage" => "Static Page",
"services" => "Services"
),
"disabled" => array(
"placebo" => "placebo", //REQUIRED!
),
),
),
array(
'id'=>'slides',
'type' => 'slides',
'title' => __('Slides Options', 'at-option'),
'subtitle'=> __('Unlimited slides with drag and drop sortings.', 'at-option'),
'desc' => __('This field will store all slides values into a multidimensional array to use into a foreach loop.', 'at-option')
),
array(
'id'=>'slides',
'type' => 'slides',
'title' => __('Slides Options', 'at-option'),
'subtitle'=> __('Unlimited slides with drag and drop sortings.', 'at-option'),
'options'=>array(
'flash' => 'flash',
'bounce' => 'bounce',
'shake' => 'shake',
'tada' => 'tada',
'wobble' => 'wobble',
'pulse' => 'pulse',
'flip' => 'flip',
'flipInX' => 'flipInX',
'flipOutX' => 'flipOutX',
'flipInY' => 'flipInY',
'flipOutY' => 'flipOutY',
'fadeIn' => 'fadeIn',
'fadeInUp' => 'fadeInUp',
'fadeInDown' => 'fadeInDown',
'fadeInLeft' => 'fadeInLeft',
'fadeInRight' => 'fadeInRight',
'fadeInUpBig' => 'fadeInUpBig',
'fadeInDownBig' => 'fadeInDownBig',
'fadeInLeftBig' => 'fadeInLeftBig',
'fadeInRightBig' => 'fadeInRightBig',
'fadeOut' => 'fadeOut',
'fadeOutUp' => 'fadeOutUp',
'fadeOutDown' => 'fadeOutDown',
'fadeOutLeft' => 'fadeOutLeft',
'fadeOutRight' => 'fadeOutRight',
'fadeOutUpBig' => 'fadeOutUpBig',
'fadeOutDownBig' => 'fadeOutDownBig',
'fadeOutLeftBig' => 'fadeOutLeftBig',
'fadeOutRightBig' => 'fadeOutRightBig',
'slideInDown' => 'slideInDown',
'slideInLeft' => 'slideInLeft',
'slideInRight' => 'slideInRight',
'slideOutUp' => 'slideOutUp',
'slideOutLeft' => 'slideOutLeft',
'slideOutRight' => 'slideOutRight',
'bounceIn' => 'bounceIn',
'bounceInDown' => 'bounceInDown',
'bounceInUp' => 'bounceInUp',
'bounceInLeft' => 'bounceInLeft',
'bounceInRight' => 'bounceInRight',
'bounceOut' => 'bounceOut',
'bounceOutDown' => 'bounceOutDown',
'bounceOutUp' => 'bounceOutUp',
'bounceOutLeft' => 'bounceOutLeft',
'bounceOutRight' => 'bounceOutRight',
'rotateIn' => 'rotateIn',
'rotateInDownLeft' => 'rotateInDownLeft',
'rotateInDownRight' => 'rotateInDownRight',
'rotateInUpLeft' => 'rotateInUpLeft',
'rotateInUpRight' => 'rotateInUpRight',
'rotateOut' => 'rotateOut',
'rotateOutDownLeft' => 'rotateOutDownLeft',
'rotateOutDownRight' => 'rotateOutDownRight',
'rotateOutUpLeft' => 'rotateOutUpLeft',
'rotateOutUpRight' => 'rotateOutUpRight',
'lightSpeedIn' => 'lightSpeedIn',
'lightSpeedOut' => 'lightSpeedOut',
'hinge' => 'hinge',
'rollIn' => 'rollIn',
'rollOut' => 'rollOut'
),
'placeholder' => array(
'title'=>"This is the title",
'description'=>"Description here",
'url'=>"Link",
'select'=>"Select an Animation",
),
// 'select2' => array() // Select 2 options
'desc' => __('This field will store all slides values into a multidimensional array to use into a foreach loop.', 'at-option')
),
array(
'id'=>'presets',
'type' => 'image_select',
'presets' => true,
'title' => __('Preset', 'at-option'),
'subtitle'=> __('This allows you to set a json string or array to override multiple preferences in your theme.', 'at-option'),
'default' => 0,
'desc'=> __('This allows you to set a json string or array to override multiple preferences in your theme.', 'at-option'),
'options' => array(
'1' => array('alt' => 'Preset 1', 'img' => ReduxFramework::$_url.'../sample/presets/preset1.png', 'presets'=>array('switch-on'=>1,'switch-off'=>1, 'switch-custom'=>1)),
'2' => array('alt' => 'Preset 2', 'img' => ReduxFramework::$_url.'../sample/presets/preset2.png', 'presets'=>'{"slider1":"1", "slider2":"0", "switch-on":"0"}'),
),
),
),
);
// Define page options metabox
$metaboxes[] = array(
'id' => 'demo-layout',
'title' => __('Cool Options', 'at-option'),
'post_types' => array( 'page', 'post', 'portfolio', 'staff', 'product' ),
'position' => 'normal', // normal, advanced, side
'priority' => 'high', // high, core, default, low
'sidebar' => true,
'sections' => $boxSections
);
$boxSections = array();
/**
Sidebar Options
**/
$sidebar_options = array();
$sidebar_options[] = array(
'fields' => array(
array(
'id' => 'sidebar',
'title' => __( 'Sidebar', 'at-option' ),
'desc' => 'Please select the sidebar you would like to display on this page. Note: You must first create the sidebar under Appearance > Widgets.',
'type' => 'select',
'data' => 'sidebars',
'default' => 'None',
),
),
);
// Define sidebar options metabox
$metaboxes[] = array(
'id' => 'page-options',
'title' => __( 'Sidebar', 'at-option' ),
'post_types' => array( 'page', 'post', 'demo_metaboxes' ),
'position' => 'side', // normal, advanced, side
'priority' => 'default', // high, core, default, low
'sidebar' => false, // enable/disable the sidebar in the normal/advanced positions
'sections' => $sidebar_options,
);
// Kind of overkill, but ahh well. ;)
//$metaboxes = apply_filters( 'your_custom_redux_metabox_filter_here', $metaboxes );
return $metaboxes;
}
add_action('redux/metaboxes/'.$redux_opt_name.'/boxes', 'redux_add_metaboxes');
endif;
// The loader will load all of the extensions automatically based on your $redux_opt_name
require_once(dirname(__FILE__).'/loader.php');
require_once get_template_directory() . '/admin/redux-extensions/config.php';
require get_template_directory() . '/admin/admin-init.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment