Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- ReduxFramework Sample Config File
- For full documentation, please visit: https://github.com/ReduxFramework/ReduxFramework/wiki
- * */
- if (!class_exists("Themewich_Options_Config")) {
- class Themewich_Options_Config {
- public $args = array();
- public $sections = array();
- public $theme;
- public $ReduxFramework;
- public function __construct() {
- if ( !class_exists("ReduxFramework" ) ) {
- return;
- }
- // This is needed. Bah WordPress bugs. ;)
- if ( true == Redux_Helpers::isTheme(__FILE__) ) {
- $this->initSettings();
- } else {
- add_action('plugins_loaded', array($this, 'initSettings'), 10);
- }
- }
- public function initSettings() {
- // Just for demo purposes. Not needed per say.
- $this->theme = wp_get_theme();
- // Set the default arguments
- $this->setArguments();
- // Set a few help tabs so you can see how it's done
- //$this->setHelpTabs();
- // Create the sections and fields
- $this->setSections();
- if (!isset($this->args['opt_name'])) { // No errors please
- return;
- }
- // If Redux is running as a plugin, this will remove the demo notice and links
- add_action( 'redux/loaded', array( $this, 'remove_demo' ) );
- // Function to test the compiler hook and demo CSS output.
- //add_filter('redux/options/'.$this->args['opt_name'].'/compiler', array( $this, 'compiler_action' ), 10, 2);
- // Above 10 is a priority, but 2 in necessary to include the dynamically generated CSS to be sent to the function.
- // Change the arguments after they've been declared, but before the panel is created
- //add_filter('redux/options/'.$this->args['opt_name'].'/args', array( $this, 'change_arguments' ) );
- // Change the default value of a field after it's been set, but before it's been useds
- //add_filter('redux/options/'.$this->args['opt_name'].'/defaults', array( $this,'change_defaults' ) );
- // Dynamically add a section. Can be also used to modify sections/fields
- // add_filter('redux/options/' . $this->args['opt_name'] . '/sections', array($this, 'dynamic_section'));
- $this->ReduxFramework = new ReduxFramework($this->sections, $this->args);
- }
- /**
- This is a test function that will let you see when the compiler hook occurs.
- It only runs if a field set with compiler=>true is changed.
- * */
- function compiler_action($options, $css) {
- //echo "<h1>The compiler hook has run!";
- //print_r($options); //Option values
- //print_r($css); // Compiler selector CSS values compiler => array( CSS SELECTORS )
- /*
- // Demo of how to use the dynamic CSS and write your own static CSS file
- $filename = dirname(__FILE__) . '/style' . '.css';
- global $wp_filesystem;
- if( empty( $wp_filesystem ) ) {
- require_once( ABSPATH .'/wp-admin/includes/file.php' );
- WP_Filesystem();
- }
- if( $wp_filesystem ) {
- $wp_filesystem->put_contents(
- $filename,
- $css,
- FS_CHMOD_FILE // predefined mode settings for WP files
- );
- }
- */
- }
- /**
- Custom function for filtering the sections array. Good for child themes to override or add to the sections.
- Simply include this function in the child themes functions.php file.
- NOTE: the defined constants for URLs, and directories will NOT be available at this point in a child theme,
- so you must use get_template_directory_uri() if you want to use any of the built in icons
- * */
- function dynamic_section($sections) {
- //$sections = array();
- $sections[] = array(
- 'title' => __('Section via hook', 'themewich'),
- 'desc' => __('<p class="description">This is a section created by adding a filter to the sections array. Can be used by child themes to add/remove sections from the options.</p>', 'themewich'),
- 'icon' => 'el-icon-paper-clip',
- // Leave this as a blank section, no options just some intro text set above.
- 'fields' => array()
- );
- return $sections;
- }
- /**
- Filter hook for filtering the args. Good for child themes to override or add to the args array. Can also be used in other functions.
- * */
- function change_arguments($args) {
- //$args['dev_mode'] = true;
- return $args;
- }
- /**
- Filter hook for filtering the default value of any given field. Very useful in development mode.
- * */
- function change_defaults($defaults) {
- $defaults['str_replace'] = "Testing filter hook!";
- return $defaults;
- }
- // Remove the demo link and the notice of integrated demo from the redux-framework plugin
- function remove_demo() {
- // Used to hide the demo mode link from the plugin page. Only used when Redux is a plugin.
- if (class_exists('ReduxFrameworkPlugin')) {
- remove_filter('plugin_row_meta', array(ReduxFrameworkPlugin::instance(), 'plugin_metalinks'), null, 2);
- // Used to hide the activation notice informing users of the demo panel. Only used when Redux is a plugin.
- remove_action('admin_notices', array(ReduxFrameworkPlugin::instance(), 'admin_notices'));
- }
- }
- public function setSections() {
- /**
- Used within different fields. Simply examples. Search for ACTUAL DECLARATION for field examples
- * */
- // Background Patterns Reader
- $sample_patterns_path = ReduxFramework::$_dir . '../sample/patterns/';
- $sample_patterns_url = ReduxFramework::$_url . '../sample/patterns/';
- $sample_patterns = array();
- if (is_dir($sample_patterns_path)) :
- if ($sample_patterns_dir = opendir($sample_patterns_path)) :
- $sample_patterns = array();
- while (( $sample_patterns_file = readdir($sample_patterns_dir) ) !== false) {
- if (stristr($sample_patterns_file, '.png') !== false || stristr($sample_patterns_file, '.jpg') !== false) {
- $name = explode(".", $sample_patterns_file);
- $name = str_replace('.' . end($name), '', $sample_patterns_file);
- $sample_patterns[] = array('alt' => $name, 'img' => $sample_patterns_url . $sample_patterns_file);
- }
- }
- endif;
- endif;
- ob_start();
- $ct = wp_get_theme();
- $this->theme = $ct;
- $item_name = $this->theme->get('Name');
- $tags = $this->theme->Tags;
- $screenshot = $this->theme->get_screenshot();
- $class = $screenshot ? 'has-screenshot' : '';
- $customize_title = sprintf(__('Customize “%s”', 'themewich'), $this->theme->display('Name'));
- ?>
- <div id="current-theme" class="<?php echo esc_attr($class); ?>">
- <?php if ($screenshot) : ?>
- <?php if (current_user_can('edit_theme_options')) : ?>
- <a href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr($customize_title); ?>">
- <img src="<?php echo esc_url($screenshot); ?>" alt="<?php esc_attr_e('Current theme preview'); ?>" />
- </a>
- <?php endif; ?>
- <img class="hide-if-customize" src="<?php echo esc_url($screenshot); ?>" alt="<?php esc_attr_e('Current theme preview'); ?>" />
- <?php endif; ?>
- <h4>
- <?php echo $this->theme->display('Name'); ?>
- </h4>
- <div>
- <ul class="theme-info">
- <li><?php printf(__('Version %s', 'themewich'), $this->theme->display('Version')); ?></li>
- </ul>
- <?php
- if ($this->theme->parent()) {
- printf(' <p class="howto">' . __('This <a href="%1$s">child theme</a> requires its parent theme, %2$s.') . '</p>', __('http://codex.wordpress.org/Child_Themes', 'themewich'), $this->theme->parent()->display('Name'));
- }
- ?>
- </div>
- </div>
- <?php
- $item_info = ob_get_contents();
- ob_end_clean();
- $sampleHTML = '';
- if (file_exists(dirname(__FILE__) . '/info-html.html')) {
- /** @global WP_Filesystem_Direct $wp_filesystem */
- global $wp_filesystem;
- if (empty($wp_filesystem)) {
- require_once(ABSPATH . '/wp-admin/includes/file.php');
- WP_Filesystem();
- }
- $sampleHTML = $wp_filesystem->get_contents(dirname(__FILE__) . '/info-html.html');
- }
- $this->sections[] = array(
- 'icon' => 'el-icon-cogs',
- 'icon_class' => 'icon-large',
- 'title' => __('General Settings', 'themewich'),
- 'fields' => array(
- /* Custom Logo */
- array(
- 'id'=>'logo',
- 'type' => 'media',
- 'url'=> true,
- 'title' => __('Logo', 'themewich'),
- 'compiler' => 'true',
- 'desc'=> __('Recommended size no wider than 300px or (600px for retina)', 'themewich'),
- 'subtitle' => __('Upload any logo file.', 'themewich'),
- ),
- array(
- 'id'=>'retina-logo',
- 'type' => 'switch',
- 'title' => __('Retina Logo', 'themewich'),
- 'subtitle'=> __('Turning this on will half the size of your logo for HDPI displays.', 'themewich'),
- "default" => 0,
- ),
- /* Custom Favicon */
- array(
- 'id'=>'favicon',
- 'type' => 'media',
- 'url'=> true,
- 'title' => __('Favicon', 'themewich'),
- 'compiler' => 'true',
- 'desc'=> __('Recommended size is 16px x 16px.', 'themewich'),
- 'subtitle' => __('Upload a favicon image.', 'themewich'),
- ),
- array(
- 'id'=>'tracking-code',
- 'type' => 'textarea',
- 'title' => __('Tracking Code', 'themewich'),
- 'subtitle' => __('Paste your Google Analytics (or other) tracking code here.', 'themewich'),
- //'validate' => 'js',
- 'hint' => array(
- // 'title' => __('Tracking Code', 'themewich'),
- 'content' => __('Be sure you are using the whole tracking code, not just a tracking number', 'themewich'),
- )
- ),
- )
- );
- $this->sections[] = array(
- 'icon' => 'el-icon-tasks',
- 'icon_class' => 'icon-large',
- 'title' => __('Customize', 'themewich'),
- 'desc' => __('To customize your theme colors, don\'t forget to check out the', 'themewich') . ' <a href="'.get_admin_url( ).'customize.php">' . __('Theme Customizer', 'themewich') . '</a>.',
- 'fields' => array(
- array(
- 'id'=>'header_layout',
- 'type' => 'radio',
- 'title' => __('Navigation Layout', 'themewich'),
- 'subtitle' => __('Choose the layout you want for your header.', 'themewich'),
- 'options' => array('regular-nav' => 'Next to Logo', 'altnav' => 'Below Logo'),//Must provide key => value pairs for radio options
- 'default' => 'regular-nav'
- ),
- array(
- 'id'=>'header_ad',
- 'type' => 'textarea',
- 'title' => __('Header Ad Area', 'themewich'),
- 'subtitle' => __('HTML Allowed', 'themewich'),
- 'desc' => __('Enter optional ad code here. You can also add any html content. It will display to the right of the logo.', 'themewich'),
- 'required' => array('header_layout','equals','altnav'),
- ),
- array(
- 'id'=>'header_spacing',
- 'type' => 'spacing',
- 'output' => array('.top-nav, .altnav .top-nav-inner'), // An array of CSS selectors to apply this font style to
- 'mode'=>'padding', // absolute, padding, margin, defaults to padding
- 'right' => false, // Disable the right
- 'left' => false, // Disable the left
- 'units' => 'px', // You can specify a unit value. Possible: px, em, %
- 'title' => __('Header Margin', 'themewich'),
- 'subtitle' => __('Choose the spacing want in your header.', 'themewich'),
- 'default' => array('padding-top' => '25px','padding-bottom' => '25px',)
- ),
- array(
- 'id'=>'sticky-nav',
- 'type' => 'switch',
- 'title' => __('Sticky Navigation', 'themewich'),
- 'subtitle'=> __('Stick the navigation to the top of the screen when scrolled on desktop browsers.', 'themewich'),
- "default" => 0,
- 1 => 'On',
- 0 => 'Off',
- ),
- array(
- 'id'=>'search-text',
- 'type' => 'text',
- 'title' => __('Search Box Default Text', 'themewich'),
- 'subtitle' => __('Enter default text for your search box.', 'themewich'),
- 'default' => 'Search...'
- ),
- array(
- 'id'=>'custom-css',
- 'type' => 'ace_editor',
- 'title' => __('Custom CSS', 'themewich'),
- 'subtitle' => __('Quickly add some CSS to your theme by adding it to this block.', 'themewich'),
- 'mode' => 'css',
- 'theme' => 'chrome',
- 'default' => ""
- ),
- array(
- 'id'=>'custom-js',
- 'type' => 'ace_editor',
- 'title' => __('Custom Javascript', 'themewich'),
- 'subtitle' => __('Quickly add some custom javascript to your theme by adding it to this block.', 'themewich'),
- 'mode' => 'javascript',
- 'theme' => 'chrome',
- 'default' => ""
- ),
- )
- );
- $this->sections[] = array(
- 'type' => 'divide',
- );
- $top_news = function_exists('wmp_get_popular') ? true : false;
- if ( ! $top_news ) {
- $notice_array = array(
- 'id'=>'info_success',
- 'type'=>'info',
- 'style'=>'critical',
- 'notice' => true,
- 'icon'=>'el-icon-exclamation-sign',
- 'title'=> __( 'Plugin Deactivated.', 'themewich' ),
- 'desc' => __( 'In order to use the breaking news section, you need to activate the WP Most Popular plugin included with the theme.', 'themewich')
- );
- } else {
- if ( isset($notice_array) ) {
- unset($notice_array);
- }
- }
- $news_array = array(
- array(
- 'id' => 'left-side-section',
- 'type' => 'section',
- 'title' => __('Left Side', 'themewich'),
- 'subtitle' => __('Options for the Left Side of the Top Bar.', 'themewich'),
- 'indent' => true // Indent all options below until the next 'section' option is set.
- ),
- array(
- 'id'=>'left-side',
- 'type' => 'switch',
- 'title' => __('Left Side', 'themewich'),
- 'subtitle'=> __('Content on the left side of the top bar.', 'themewich'),
- "default" => 1,
- 'on' => 'Breaking News Ticker',
- 'off' => 'Text',
- ),
- array(
- 'id'=>'left-text',
- 'type' => 'editor',
- 'required' => array('left-side','=','0'),
- 'title' => __('Top Text', 'themewich'),
- 'subtitle' => __('Enter text you want in the top left.', 'themewich'),
- 'default' => '',
- ),
- array(
- 'id'=>'breaking-number',
- 'type' => 'spinner',
- 'required' => array('left-side','=','1'),
- 'title' => __('Number of Posts to Cycle Through', 'themewich'),
- 'subtitle' => __('Select the number of posts to cycle through.', 'themewich'),
- "default" => "5",
- "min" => "1",
- "step" => "1",
- "max" => "100",
- ),
- array(
- 'id'=>'breaking-text-switch',
- 'type' => 'switch',
- 'required' => array('left-side','=','1'),
- 'title' => __('Replace "Breaking" Title?', 'themewich'),
- 'subtitle'=> __('Turn this on to replace "Breaking" in the top bar.', 'themewich'),
- "default" => 0,
- ),
- array(
- 'id'=>'breaking-text',
- 'type' => 'text',
- 'required' => array('breaking-text-switch','=','1'),
- 'title' => __('Change "Breaking" text.', 'themewich'),
- 'subtitle' => __('Change "Breaking" to something else.', 'themewich'),
- ),
- array(
- 'id'=>'breaking-timeline',
- 'type' => 'select',
- 'required' => array('left-side','=','1'),
- 'title' => __('Timeline', 'themewich'),
- 'subtitle' => __('Select the popularity timeline.', 'themewich'),
- 'options' => array('1' => 'All Time','2' => 'Monthly','3' => 'Weekly', '4' => 'Daily'),
- 'default' => '2'
- ),
- array(
- 'id'=>'breaking-delay',
- 'type' => 'spinner',
- 'required' => array('left-side','=','1'),
- 'title' => __('Delay between posts.', 'themewich'),
- 'subtitle' => __('Select the number of seconds to show each post.', 'themewich'),
- "default" => "4",
- "min" => "1",
- "step" => "1",
- "max" => "100",
- ),
- array(
- 'id'=>'breaking-animation',
- 'type' => 'select',
- 'required' => array('left-side','=','1'),
- 'title' => __('Animation', 'themewich'),
- 'subtitle' => __('Select the breaking news animation type', 'themewich'),
- 'options' => array('1' => 'Ticker','2' => 'Fade', '3' => 'Vertical Slide'),
- 'default' => '3'
- ),
- array(
- 'id' => 'right-side-section',
- 'type' => 'section',
- 'title' => __('Right Side', 'themewich'),
- 'subtitle' => __('Options for the Right Side of the Top Bar.', 'themewich'),
- 'indent' => true // Indent all options below until the next 'section' option is set.
- ),
- array(
- 'id'=>'right-side',
- 'type' => 'switch',
- 'title' => __('Right Side', 'themewich'),
- 'subtitle'=> __('Content on the left side of the top bar.', 'themewich'),
- "default" => 1,
- 'on' => 'Social Icons',
- 'off' => 'Text',
- ),
- array(
- 'id'=>'right-text',
- 'type' => 'editor',
- 'required' => array('right-side','=','0'),
- 'title' => __('Top Text', 'themewich'),
- 'subtitle' => __('Enter text you want in the top right.', 'themewich'),
- 'default' => '',
- ),
- array(
- 'id' => 'social-order',
- 'type' => 'sortable',
- 'mode' => 'checkbox', // checkbox or text
- 'title' => __('Social Icons', 'themewich'),
- 'required' => array('right-side','=','1'),
- 'subtitle' => __('Define which icons you want to show and reorder these however you want.', 'themewich'),
- 'options' => array(
- 'facebook' => 'Facebook',
- 'twitter' => 'Twitter',
- 'dribbble' => 'Dribbble',
- 'youtube-play' => 'YouTube',
- 'vimeo-square' => 'Vimeo',
- 'linkedin' => 'LinkedIn',
- 'vimeo-square' => 'Vimeo',
- 'pinterest' => 'Pinterest',
- 'github' => 'Github',
- 'google-plus-square' => 'Google+',
- 'instagram' => 'Instagram',
- 'stack-overflow' => 'Stack Overflow',
- 'trello' => 'Trello',
- 'tumblr' => 'Tumblr',
- ),
- //See how default has changed? you also don't need to specify opts that are 0.
- 'default' => array(
- 'facebook' => '1',
- 'twitter' => '1',
- 'dribbble' => '1',
- 'youtube-play' => '0',
- 'vimeo-square' => '0',
- 'linkedin' => '0',
- 'vimeo-square' => '0',
- 'pinterest' => '0',
- 'github' => '0',
- 'google-plus-square' => '0',
- 'instagram' => '0',
- 'stack-overflow' => '0',
- 'trello' => '0',
- 'tumblr' => '0',
- )
- ),
- array(
- 'id'=>'social-urls',
- 'type' => 'text',
- 'customizer' => false,
- 'title' => __('Social Link URLs', 'themewich'),
- 'subtitle' => __('Enter your social link urls.', 'themewich'),
- 'required' => array('right-side','=','1'),
- 'options' => array(
- 'facebook' => 'Facebook URL',
- 'twitter' => 'Twitter URL',
- 'dribbble' => 'Dribbble URL',
- 'youtube-play' => 'YouTube URL',
- 'vimeo-square' => 'Vimeo URL',
- 'linkedin' => 'LinkedIn URL',
- 'pinterest' => 'Pinterest URL',
- 'github' => 'Github URL',
- 'google-plus-square' => 'Google+ URL',
- 'instagram' => 'Instagram URL',
- 'stack-overflow' => 'Stack Overflow URL',
- 'trello' => 'Trello URL',
- 'tumblr' => 'Tumblr URL',
- ),
- 'default' => array(
- 'facebook' => '',
- 'twitter' => '',
- 'dribbble' => '',
- 'youtube-play' => '',
- 'vimeo-square' => '',
- 'linkedin' => '',
- 'vimeo-square' => '',
- 'pinterest' => '',
- 'github' => '',
- 'google-plus-square' => '',
- 'instagram' => '',
- 'stack-overflow' => '',
- 'trello' => '',
- 'tumblr' => '',
- ),
- ),
- );
- if ( isset($notice_array) ) {
- array_unshift($news_array, $notice_array);
- }
- $this->sections[] = array(
- 'icon' => 'el-icon-bullhorn',
- 'icon_class' => 'icon-large',
- 'title' => __('Top Bar', 'themewich'),
- 'customizer' => false,
- 'desc' => __('Options for the top bar of your theme.', 'themewich'),
- 'fields' => $news_array
- );
- $this->sections[] = array(
- 'icon' => 'el-icon-pencil',
- 'icon_class' => 'icon-large',
- 'title' => __('Post Settings', 'themewich'),
- 'fields' => array(
- /* array( // coming soon
- 'id'=>'layout',
- 'type' => 'image_select',
- 'compiler'=>true,
- 'title' => __('Default Post Layout', 'themewich'),
- 'subtitle' => __('Select the default layout of your posts. You can overwrite this on an individual post setting.', 'themewich'),
- 'options' => array(
- '1' => array('alt' => '1 Column', 'img' => ReduxFramework::$_url.'assets/img/1col.png'),
- '2' => array('alt' => '2 Column Right', 'img' => ReduxFramework::$_url.'assets/img/2cr.png'),
- ),
- 'default' => '2'
- ), */
- array(
- 'id'=>'auto_dropcap',
- 'type' => 'button_set',
- 'title' => __('Automatic Dropcap', 'themewich'),
- 'subtitle'=> __('Choose whether to display an automatic dropcap for the first letter of your post.', 'themewich'),
- 'options' => array('1' => 'On','0' => 'Off'),//Must provide key => value pairs for radio options
- 'default' => '1'
- ),
- array(
- 'id'=>'large-top-image',
- 'type' => 'button_set',
- 'title' => __('Default Featured Image Style', 'themewich'),
- 'subtitle'=> __('Choose whether to display the featured image as a large, full-width image at the top of the post.', 'themewich'),
- 'options' => array('1' => 'Full Width','0' => 'Regular Width'),//Must provide key => value pairs for radio options
- 'default' => '1'
- ),
- array(
- 'id'=>'sharing',
- 'type' => 'switch',
- 'title' => __('Default Post Sharing', 'themewich'),
- 'subtitle'=> __('Display sharing options to the right of the content.', 'themewich'),
- "default" => 1,
- ),
- array(
- 'id'=>'related_posts',
- 'type' => 'switch',
- 'title' => __('Default Related Posts', 'themewich'),
- 'subtitle'=> __('Display related posts at the bottom of your posts', 'themewich'),
- "default" => 1,
- ),
- )
- );
- $this->sections[] = array(
- 'type' => 'divide',
- );
- $this->sections[] = array(
- 'icon' => 'el-icon-font',
- 'icon_class' => 'icon-large',
- 'title' => __('Theme Fonts', 'themewich'),
- 'fields' => array(
- array(
- 'id' => 'large-headings',
- 'type' => 'typography',
- 'title' => __('Large Featured Headings', 'themewich'),
- 'google' => true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height' => false,
- 'text-align' => false,
- 'letter-spacing'=> true, // Defaults to false
- 'text-transform' => true,
- 'color' => false,
- 'update_weekly' => false,
- 'output' => array('.section .slidecaption .slidetitle,
- .section .slidecaption h1,
- .single-post .pagetitle .title,
- #share-box h4'), // An array of CSS selectors to apply this font style to dynamically
- 'units' => 'px', // Defaults to px
- 'subtitle' => __('Set your font choice for the site-wide large headings. This includes full image posts and slideshow section headings.', 'themewich'),
- 'default' => array(
- 'font-weight'=>'900',
- 'font-family'=>'Lato',
- 'text-transform' => 'uppercase',
- 'google' => true,
- 'font-size'=>'60px',
- 'line-height' => '1em'
- ),
- ),
- array(
- 'id'=>'medium-headings',
- 'type' => 'typography',
- 'title' => __('Medium Featured Headings', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('.grid .thumbovertext .title,
- .carousel .carouselpost .thumbovertext .title,
- .full-image-section .fullsection .title,
- .single .no-full-image h1.title'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the site-wide medium headings. This includes large grid, regular single post and full width link section headings.', 'themewich'),
- 'default'=> array(
- 'font-weight'=>'900',
- 'font-family'=>'Lato',
- 'text-transform' => 'uppercase',
- 'google' => true,
- 'font-size'=>'44px',
- 'line-height' => '1em'
- ),
- ),
- array(
- 'id'=>'small-headings',
- 'type' => 'typography',
- 'title' => __('Small Featured Headings', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('.regulargrid .title,
- .carousel.half-carousel .carouselpost .thumbovertext .title,
- .halfgrid .thumbovertext .title,
- .related .thumbovertext .title'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the site-wide small headings. This includes small grid headings, regular post index headings and section titles.', 'themewich'),
- 'default'=> array(
- 'font-weight'=>'900',
- 'font-family'=>'Lato',
- 'text-transform' => 'uppercase',
- 'google' => true,
- 'font-size'=>'28px',
- 'line-height' => '1em'
- ),
- ),
- array(
- 'id'=>'default-headings',
- 'type' => 'typography',
- 'title' => __('Default Theme Headings', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('.pagetitle .title,
- #logo a,
- .full-post .full-image-section .fullsection .title'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the site-wide default headings. This includes page titles and full width post sections.', 'themewich'),
- 'default'=> array(
- 'font-weight'=>'900',
- 'font-family'=>'Lato',
- 'text-transform' => 'uppercase',
- 'google' => true,
- 'font-size'=>'32px',
- 'line-height' => '1em'
- ),
- ),
- array(
- 'id'=>'subtitles',
- 'type' => 'typography',
- 'title' => __('Theme Subtitles', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'font-size'=>false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('.pagertitle, .full-taxonomy .fullsection .subtitle, .pagetitle .subheadline'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the site-wide subtitle fonts.', 'themewich'),
- 'default'=> array(
- 'font-weight'=>'300',
- 'font-family'=>'Lato',
- 'google' => true,
- 'font-size'=>'20px',
- 'line-height' => '18px'),
- ),
- array(
- 'id'=>'section-titles',
- 'type' => 'typography',
- 'title' => __('Section and Widget Titles', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'font-size' =>false,
- 'color'=>false,
- 'output' => array(
- '.section-title span,
- .widget h3.widget-title,
- .widget h2.widget-title,
- .widget h4.widget-title'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the section titles.', 'themewich'),
- 'default'=> array(
- 'font-weight'=>'700',
- 'font-family'=>'Lato',
- 'text-transform' => 'uppercase',
- 'letter-spacing' => '1px',
- 'google' => true,
- 'font-size'=>'22px'),
- ),
- array(
- 'id'=>'top-nav-font',
- 'type' => 'typography',
- 'title' => __('Top Level Navigation Font', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('.sf-menu li > a'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for your top level site navigation and megamenu headings.', 'themewich'),
- 'default'=> array(
- 'color'=>"#777",
- 'font-weight'=>'600',
- 'font-family'=>'Lato',
- 'google' => true,
- 'letter-spacing' => '1px',
- 'font-size'=>'12px',
- 'line-height' => '1em',
- 'text-transform' => 'uppercase'),
- ),
- array(
- 'id'=>'tiny-details',
- 'type' => 'typography',
- 'title' => __('Tiny Details Font', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array(
- '.tiny-details, .badge, .badge a, .thumboverdate,
- .badgesliver, .sharing a .sharetitle, a.button.outline,
- a.more-link, .tagcloud.badge h5,
- a.post-edit-link, .tabswrap ul.tabs li a,
- ul.sf-menu li.megamenu .menu-item-type-custom > a,
- ul.sf-menu li.megamenu .menu-item-type-custom .menu-item-type-custom > a,
- .breaking, .breaking-title, .divider span, cite,
- #breadcrumbs li'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the headers.', 'themewich'),
- 'default'=> array(
- 'font-weight'=>'400',
- 'font-family'=>'Lato',
- 'text-transform' => 'uppercase',
- 'letter-spacing' => '2px',
- 'google' => true,
- 'line-height' => '1em',
- 'font-size'=>'10px'),
- ),
- ),
- );
- $this->sections[] = array(
- 'icon' => 'el-icon-fontsize',
- 'icon_class' => 'icon-large',
- 'title' => __('Content Fonts', 'themewich'),
- 'fields' => array(
- array(
- 'id'=>'heading-font',
- 'type' => 'typography',
- 'title' => __('H1 Heading Font', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('h1, .postcontent.no-review > p:first-child:first-letter'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the headers.', 'themewich'),
- 'default'=> array(
- 'color'=>"#333",
- 'font-weight'=>'300',
- 'font-family'=>'Lato',
- 'google' => true,
- 'font-size'=>'58px',
- 'line-height' => '2em'),
- ),
- array(
- 'id'=>'heading-font2',
- 'type' => 'typography',
- 'title' => __('H2 Heading Font', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('h2, blockquote, blockquote p'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the headers.', 'themewich'),
- 'default'=> array(
- 'color'=>"#333",
- 'font-weight'=>'300',
- 'font-family'=>'Lato',
- 'google' => true,
- 'font-size'=>'28px',
- 'line-height' => '2em'),
- ),
- array(
- 'id'=>'heading-font3',
- 'type' => 'typography',
- 'title' => __('H3 Heading Font', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('h3'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the headers.', 'themewich'),
- 'default'=> array(
- 'color'=>"#333",
- 'font-weight'=>'400',
- 'font-family'=>'Lato',
- 'google' => true,
- 'font-size'=>'22px',
- 'line-height' => '2em'),
- ),
- array(
- 'id'=>'heading-font4-6',
- 'type' => 'typography',
- 'title' => __('H4 - H6 Heading Fonts', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('h4, h5, h6'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'font-size'=>false,
- 'subtitle'=> __('Set your font choice for the headers.', 'themewich'),
- 'default'=> array(
- 'color'=>"#333",
- 'font-weight'=>'700',
- 'font-family'=>'Lato',
- 'google' => true,
- 'font-size'=>'18px',
- 'line-height' => '2em'),
- ),
- array(
- 'id'=>'paragraph-type',
- 'type' => 'typography',
- 'title' => __('Paragraph and Body Font', 'themewich'),
- 'google'=>true, // Disable google fonts. Won't work if you haven't defined your google api key
- 'line-height'=>false,
- 'text-align' => false,
- 'letter-spacing'=>true, // Defaults to false
- 'text-transform'=>true,
- 'update_weekly' => false,
- 'color'=>false,
- 'output' => array('p, ul, ol, body, h4.review-title'), // An array of CSS selectors to apply this font style to dynamically
- 'units'=>'px', // Defaults to px
- 'subtitle'=> __('Set your font choice for the site-wide page headers and main slideshow title.', 'themewich'),
- 'default'=> array(
- 'color'=>"#333",
- 'font-weight'=>'400',
- 'font-family'=>'Lato',
- 'google' => true,
- 'font-size'=>'16px',
- 'line-height' => '2em'),
- ),
- )
- );
- if ( function_exists('wp_get_theme') ) {
- $theme_data = wp_get_theme();
- $theme_uri = $theme_data->get('ThemeURI');
- $description = $theme_data->get('Description');
- $author = $theme_data->get('Author');
- $version = $theme_data->get('Version');
- $tags = $theme_data->get('Tags');
- } else {
- $theme_data = wp_get_theme(trailingslashit(get_stylesheet_directory()).'style.css');
- $theme_uri = $theme_data['URI'];
- $description = $theme_data['Description'];
- $author = $theme_data['Author'];
- $version = $theme_data['Version'];
- $tags = $theme_data['Tags'];
- }
- $theme_info = '<div class="redux-framework-section-desc">';
- $theme_info .= '<p class="redux-framework-theme-data description theme-uri">'.__('<strong>Theme URL:</strong> ', 'themewich').'<a href="'.$theme_uri.'" target="_blank">'.$theme_uri.'</a></p>';
- $theme_info .= '<p class="redux-framework-theme-data description theme-author">'.__('<strong>Author:</strong> ', 'themewich').$author.'</p>';
- $theme_info .= '<p class="redux-framework-theme-data description theme-version">'.__('<strong>Version:</strong> ', 'themewich').$version.'</p>';
- $theme_info .= '<p class="redux-framework-theme-data description theme-description">'.$description.'</p>';
- if ( !empty( $tags ) ) {
- $theme_info .= '<p class="redux-framework-theme-data description theme-tags">'.__('<strong>Tags:</strong> ', 'themewich').implode(', ', $tags).'</p>';
- }
- $theme_info .= '</div>';
- $this->sections[] = array(
- 'type' => 'divide',
- );
- $this->sections[] = array(
- 'icon' => 'el-icon-download',
- 'title' => __('Updates', 'themewich'),
- 'desc' => __('<p class="description">Get Automatic Theme Updates</p>', 'themewich'),
- 'fields' => array(
- array(
- 'id'=>'tf_username',
- 'type' => 'text',
- 'title' => __('Themeforest Username', 'themewich'),
- 'subtitle' => __('Enter your Themeforest Username that you used to purchase the this theme.', 'themewich'),
- ),
- array(
- 'id'=>'tf_api',
- 'type' => 'text',
- 'title' => __('Themeforest API Key', 'themewich'),
- 'subtitle' => __('You can find your API key by Logging into Themeforest, visiting your Dashboard page then clicking the My Settings tab. At the bottom of the page you will find your account API key and a button to regenerate it as needed.', 'themewich'),
- ),
- array(
- 'id'=>'raw_new_info',
- 'title' => __('Your Version', 'themewich'),
- 'type' => 'raw',
- 'content' => $item_info,
- )
- ),
- );
- $this->sections[] = array(
- 'icon' => 'el-icon-dashboard',
- 'title' => __('Advanced', 'themewich'),
- 'desc' => '<p class="description">' . __('Advanced Options</p>', 'themewich') . '</p>',
- 'fields' => array(
- array(
- 'id'=>'help_page',
- 'type' => 'switch',
- 'title' => __('Show Help Page', 'themewich'),
- 'subtitle'=> __('Turn this off to hide the help page.', 'themewich'),
- "default" => 1,
- ),
- ),
- );
- }
- public function setHelpTabs() {
- // Custom page help tabs, displayed using the help API. Tabs are shown in order of definition.
- $this->args['help_tabs'][] = array(
- 'id' => 'redux-opts-1',
- 'title' => __('Theme Information 1', 'themewich'),
- 'content' => __('<p>This is the tab content, HTML is allowed.</p>', 'themewich')
- );
- $this->args['help_tabs'][] = array(
- 'id' => 'redux-opts-2',
- 'title' => __('Theme Information 2', 'themewich'),
- 'content' => __('<p>This is the tab content, HTML is allowed.</p>', 'themewich')
- );
- // Set the help sidebar
- $this->args['help_sidebar'] = __('<p>This is the sidebar content, HTML is allowed.</p>', 'themewich');
- }
- /**
- All the possible arguments for Redux.
- For full documentation on arguments, please refer to: https://github.com/ReduxFramework/ReduxFramework/wiki/Arguments
- * */
- public function setArguments() {
- $theme = wp_get_theme(); // For use with some settings. Not necessary.
- $this->args = array(
- // TYPICAL -> Change these values as you need/desire
- 'opt_name' => 'tw_options', // This is where your data is stored in the database and also becomes your global variable name.
- 'display_name' => $theme->get('Name'), // Name that appears at the top of your panel
- 'display_version' => $theme->get('Version'), // Version that appears at the top of your panel
- 'menu_type' => 'menu', //Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only)
- 'allow_sub_menu' => true, // Show the sections below the admin menu item or not
- 'menu_title' => __('Theme Options', 'themewich'),
- 'page' => __('Theme Options', 'themewich'),
- // You will need to generate a Google API key to use this feature.
- // Please visit: https://developers.google.com/fonts/docs/developer_api#Auth
- 'google_api_key' => 'AIzaSyBvTFqTI2TwUiB8SaDfHrZM3TnH_qsE4aw', // Must be defined to add google fonts to the typography module
- //'admin_bar' => false, // Show the panel pages on the admin bar
- 'global_variable' => '', // Set a different name for your global variable other than the opt_name
- 'dev_mode' => false, // Show the time the page took to load, etc
- 'customizer' => true, // Enable basic customizer support
- // OPTIONAL -> Give you extra features
- 'page_priority' => null, // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
- 'page_parent' => 'themes.php', // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
- 'page_permissions' => 'manage_options', // Permissions needed to access the options panel.
- 'menu_icon' => '', // Specify a custom URL to an icon
- 'last_tab' => '', // Force your panel to always open to a specific tab (by id)
- 'page_icon' => 'icon-themes', // Icon displayed in the admin panel next to your menu_title
- 'page_slug' => '_options', // Page slug used to denote the panel
- 'save_defaults' => true, // On load save the defaults to DB before user clicks save or not
- 'default_show' => false, // If true, shows the default value next to each field that is not the default value.
- 'default_mark' => '', // What to print by the field's title if the value shown is default. Suggested: *
- // CAREFUL -> These options are for advanced use only
- 'transient_time' => 60 * MINUTE_IN_SECONDS,
- 'output' => true, // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output
- 'output_tag' => true, // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head
- //'domain' => 'redux-framework', // Translation domain key. Don't change this unless you want to retranslate all of Redux.
- 'footer_credit' => 'Thank you for creating with <a href="http://themewich.com" target="_blank">Themewich</a>. Powered by the <a href="https://github.com/ReduxFramework/ReduxFramework" target="_blank">Redux Options Framework.</a>', // Disable the footer credit of Redux. Please leave if you can help it.
- // FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk.
- 'database' => '', // possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!
- 'show_import_export' => true, // REMOVE
- 'system_info' => false, // REMOVE
- 'help_tabs' => array(),
- 'help_sidebar' => '', // __( '', $this->args['domain'] );
- // HINTS
- 'hints' => array(
- 'icon' => 'icon-question-sign',
- 'icon_position' => 'right',
- 'icon_color' => 'lightgray',
- 'icon_size' => 'normal',
- 'tip_style' => array(
- 'color' => 'light',
- 'shadow' => true,
- 'rounded' => false,
- 'style' => 'bootstrap',
- ),
- 'tip_position' => array(
- 'my' => 'bottom left',
- 'at' => 'top right',
- ),
- 'tip_effect' => array(
- 'show' => array(
- 'effect' => 'fade',
- 'duration' => '500',
- 'event' => 'mouseover',
- ),
- 'hide' => array(
- 'effect' => 'fade',
- 'duration' => '500',
- 'event' => 'click mouseleave',
- ),
- ),
- ),
- );
- // SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons.
- $this->args['share_icons'][] = array(
- 'url' => 'http://twitter.com/ajgagnon',
- 'title' => 'Visit me on Twitter',
- 'icon' => 'el-icon-twitter'
- // 'img' => '', // You can use icon OR img. IMG needs to be a full URL.
- );
- $this->args['share_icons'][] = array(
- 'url' => 'http://dribbble.com/ajgagnon',
- 'title' => 'Find me on Dribbble',
- 'icon' => ' el-icon-dribbble'
- );
- $this->args['share_icons'][] = array(
- 'url' => 'http://themeforest.net/user/2winFactor',
- 'title' => 'Follow me on Themeforest',
- 'icon' => 'el-icon-leaf'
- );
- $this->args['share_icons'][] = array(
- 'url' => 'http://support.themewich.com',
- 'title' => 'Get Support',
- 'icon' => 'el-icon-group'
- );
- // Add content after the form.
- $this->args['footer_text'] = __('<p style="margin-top:20px;"><a class="icon-a icon-gallery" href="http://themeforest.net/user/2winFactor/portfolio?ref=2winfactor" target="_blank" style="font-size:14px; color:#777; text-decoration:none; margin-right:10px;"><i class="el-icon-website"></i> More Themes</a>
- <a class="icon-a icon-support" href="http://support.themewich.com" target="_blank" style="font-size:14px; color:#777; text-decoration:none; margin-right:10px;"><i class="el-icon-group"></i> Support Forum</a>
- <a class="icon-a icon-documentation" href="' . get_template_directory_uri() . '/pdf/documentation.pdf" target="_blank" style="font-size:14px; color:#777; text-decoration:none; margin-right:10px;"><i class="el-icon-paper-clip"></i> Documentation</a>
- </p>', 'themewich');
- }
- }
- new Themewich_Options_Config();
- }
- /**
- Custom function for the callback referenced above
- */
- if (!function_exists('redux_my_custom_field')):
- function redux_my_custom_field($field, $value) {
- print_r($field);
- print_r($value);
- }
- endif;
- /**
- Custom function for the callback validation referenced above
- * */
- if (!function_exists('redux_validate_callback_function')):
- function redux_validate_callback_function($field, $value, $existing_value) {
- $error = false;
- $value = 'just testing';
- /*
- do your validation
- if(something) {
- $value = $value;
- } elseif(something else) {
- $error = true;
- $value = $existing_value;
- $field['msg'] = 'your custom error message';
- }
- */
- $return['value'] = $value;
- if ($error == true) {
- $return['error'] = $field;
- }
- return $return;
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement