reduxframework / redux-framework

Redux is a simple, truly extensible options framework for WordPress themes and plugins!
http://redux.io
Other
1.73k stars 583 forks source link

Save_defaults #2875

Closed mlyczko closed 8 years ago

mlyczko commented 8 years ago

Hi

I have a problem: When i install theme for a first theme i have many warnings about data from my Theme Options basend on REDUX. When i refresh dashborad twice the problem is gone: http://screencast.com/t/NKXWSvRF

I have "save_defaults" to TRUE: 'save_defaults' => TRUE,

Support Hash: http://support.redux.io/?id=ePQ8lGHiWmlH%2BW%2Fmdxopw3tBDt%2BrN8QxvUwbImRDt1McI3kd9JO%2BnlCWqX0Y2LYHPLsTznkNoxZOTH682A88DQ%3D%3D

Best Regards ML

dovy commented 8 years ago

You're trying to grab your global variable before it's defined. The best action is as follows:

add_action('switch_theme', 'mytheme_setup_options');
function mytheme_setup_options () {
  // Make sure all options are fully loaded here and Redux is included.
  Redux::init('OPT_NAME');
}

The issue is your theme is trying to pull values, but Redux never had a chance to run.

mlyczko commented 8 years ago

Hi

I can't make it work. Where exactly should i use your code? My options-init.php: `<?php

/**
 * For full documentation, please visit: http://docs.reduxframework.com/
 * For a more extensive sample-config file, you may look at:
 * https://github.com/reduxframework/redux-framework/blob/master/sample/sample-config.php
 */

if ( ! class_exists( 'Redux' ) ) {
    return;
}

// This is your option name where all the Redux data is stored.
$opt_name = "redux_pixelemu";

/**
 * ---> SET ARGUMENTS
 * All the possible arguments for Redux.
 * For full documentation on arguments, please refer to: https://github.com/ReduxFramework/ReduxFramework/wiki/Arguments
 * */

$theme = wp_get_theme(); // For use with some settings. Not necessary.

$args = array(
    'opt_name' => 'redux_pixelemu',
    'display_name' => __( 'Theme Options', 'PixelEmu' ),
    'display_version' => '1.0.0',
    'page_slug' => 'pixelemu_options',
    'page_title' => __( 'Theme Options', 'PixelEmu' ),
    'update_notice' => TRUE,
    'admin_bar' => TRUE,
    'menu_type' => 'menu',
    'menu_title' => __( 'Theme Options', 'PixelEmu' ),
    'allow_sub_menu' => TRUE,
    'page_priority' => '2',
    'customizer' => TRUE,
    'default_mark' => '*',
    'class' => 'pixelemu-options',
    'hints' => array(
        'icon_position' => 'left',
        'icon_size' => 'normal',
        'tip_style' => array(
            'color' => 'light',
        ),
        'tip_position' => array(
            'my' => 'top left',
            'at' => 'bottom right',
        ),
        'tip_effect' => array(
            'show' => array(
                'duration' => '500',
                'event' => 'mouseover',
            ),
            'hide' => array(
                'duration' => '500',
                'event' => 'mouseleave unfocus',
            ),
        ),
    ),
    'output' => TRUE,
    'output_tag' => TRUE,
    'settings_api' => TRUE,
    'cdn_check_time' => '1440',
    'compiler' => TRUE,
    'page_permissions' => 'manage_options',
    'save_defaults' => TRUE,
    'show_import_export' => TRUE,
    'database' => 'options',
    'transient_time' => '3600',
    'network_sites' => TRUE,
    'dev_mode' => FALSE,
    'default_show' => FALSE,
    'menu_icon' => get_template_directory_uri().'/images/admin/pe_icon.png'
);

// SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons.
$args['share_icons'][] = array(
    'url'   => 'http://www.facebook.com/PixelEmu',
    'title' => __( 'Like us on Facebook', 'PixelEmu' ),
    'icon'  => 'el el-facebook'
);
$args['share_icons'][] = array(
    'url'   => 'https://twitter.com/PixelEmu',
    'title' => __( 'Follow us on Twitter', 'PixelEmu' ),
    'icon'  => 'el el-twitter'
);
$args['share_icons'][] = array(
    'url'   => 'https://plus.google.com/u/0/+Pixelemu/posts',
    'title' => __( 'Find us on Google Plus', 'PixelEmu' ),
    'icon'  => 'el el-icon-googleplus'
);
$args['share_icons'][] = array(
    'url'   => 'https://www.youtube.com/channel/UC8gwlTKMLRG21SUo0YvgJIA',
    'title' => __( 'Find us on Youtube', 'PixelEmu' ),
    'icon'  => 'el el-icon-youtube'
);
$args['share_icons'][] = array(
    'url'   => 'https://www.behance.net/PixelEmu',
    'title' => __( 'Find us on Behance', 'PixelEmu' ),
    'icon'  => 'el el-icon-behance'
);

Redux::setArgs( $opt_name, $args );

/*
 * ---> END ARGUMENTS
 */

/*
 *
 * ---> START SECTIONS
 *
 */

Redux::setSection( $opt_name, array(
    'title'      => __( 'Basic Settings', 'PixelEmu' ),
    'id'         => 'basic-settings',
    //'subsection' => true,
    'fields'     => array(
        array(
            'id'       => 'logo',
            'type'     => 'background',
            'background-color' => false,
            'background-repeat' => false,
            'background-attachment' => false,
            'background-position' => false,
            'background-clip' => false,
            'background-origin' => false,
            'background-size' => false,
            'title'    => __( 'Logo', 'PixelEmu' ),
            'subtitle' => __( 'Upload a logo image here.', 'PixelEmu' ),
        ),
        array (
            'id' => 'favicon',
            'type' => 'background',
            'background-color' => false,
            'background-repeat' => false,
            'background-attachment' => false,
            'background-position' => false,
            'background-clip' => false,
            'background-origin' => false,
            'background-size' => false,
            'operator' => 'and',
            'title' => __( 'Favicon', 'PixelEmu' ),
            'subtitle' => __( 'Upload a favicon file here.', 'PixelEmu' ),
        ),
        array(
            'id'       => 'back-to-top',
            'type'     => 'switch', 
            'title'    => __('Back to Top', 'PixelEmu'),
            'subtitle' => __('Enable/disable back to top button.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'off-canavs-sidebar',
            'type'     => 'switch', 
            'title'    => __('Off-Canvas sidebar', 'PixelEmu'),
            'subtitle' => __('Enable/disable the Off-Canvas sidebar.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'off-canavs-width',
            'type'     => 'dimensions',
            'height'   => false,
            'units'    => array('px'),
            'title'    => __('Off-Canvas Width', 'PixelEmu'),
            'subtitle' => __('Enter the Off-Canvas width.', 'PixelEmu'),
            'default'  => array(
                'width'   => '300'
            ),
        ),
        array(
            'id'       => 'off-canavs-position',
            'type'     => 'select',
            'title'    => __('Off-Canvas position', 'PixelEmu'), 
            'subtitle' => __('Choose the position of Off-Canvas sidebar.', 'PixelEmu'),
            'options'  => array(
                'right' => 'Right',
                'left' => 'Left'
            ),
            'default'  => 'right',
        ),
        array(
            'id'       => 'coming-soon',
            'type'     => 'switch', 
            'title'    => __('Coming Soon', 'PixelEmu'),
            'subtitle' => __('Choose if you want to enable Coming Soon page.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'          => 'coming-soon-until-date',
            'type'        => 'date',
            'title'       => __('Coming Soon Until Date', 'PixelEmu'), 
            'subtitle'    => __('Coming Soon date', 'PixelEmu'),
            'desc'        => __('Format: Month/Day/Year', 'PixelEmu'),
            'placeholder' => 'Click to enter a date'
        ),
    )
) );

Redux::setSection( $opt_name, array(
    'title'      => __( 'Main Menu', 'PixelEmu' ),
    'id'         => 'main-menu',
    'fields'     => array(
        array(
            'id'       => 'sticky-topbar',
            'type'     => 'switch', 
            'title'    => __('Sticky Topbar', 'PixelEmu'),
            'subtitle' => __('Enable/disable the sticky topbar with the menu.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'responsive-breakpoint',
            'type'     => 'dimensions',
            'height'   => false,
            'units'    => 'px',
            'title'    => __('Responsive Breakpoint', 'PixelEmu'),
            'subtitle' => __('Set the width at which the menu turns into a mobile menu.', 'PixelEmu'),
            'default'  => array(
                'width'   => '960px'
            ),
        ),
        array(
            'id'          => 'mainmenu-typography',
            'type'        => 'typography', 
            'title'       => __('Main Menu', 'PixelEmu'),
            'google'      => true, 
            'font-backup' => true,
            'text-transform' => true,
            'line-height' => false,
            'font-style'  => true,
            'font-weight'  => true,
            'letter-spacing' => true,
            'text-align' => false,
            'units'       =>'px',
            'subtitle'    => __('Typography for Main Menu.', 'PixelEmu'),
            'default'     => array(
                'color'       => '#ffffff', 
                'font-weight'  => '700',
                'letter-spacing' => 'normal',
                'text-transform' => 'uppercase',
                'font-family' => 'Open Sans',
                'font-backup' => 'Arial, Helvetica, sans-serif',
                'google'      => true,
                'font-size'   => '11px'
            ),
        ),
        array(
            'id'          => 'mainmenu-typography-submenu',
            'type'        => 'typography', 
            'title'       => __('Main Menu Submenu', 'PixelEmu'),
            'google'      => false,
            'color' => false,
            'font-size' => true,
            'font-family' => false,
            'font-backup' => false,
            'text-transform' => false,
            'line-height' => false,
            'font-style'  => false,
            'font-weight'  => true,
            'letter-spacing' => false,
            'text-align' => false,
            'units'       =>'px',
            'subtitle'    => __('Typography for Main Menu Submenu.', 'PixelEmu'),
            'default'     => array(
                'font-weight'  => '400',
                'font-size'   => '11px'
            ),
        ),
        array(
            'id'          => 'mainmenu-typography-hover',
            'type'        => 'typography', 
            'title'       => __('Main Menu (Hover & Active)', 'PixelEmu'),
            'google'      => false, 
            'font-size' => false,
            'font-family' => false,
            'font-backup' => false,
            'text-transform' => false,
            'line-height' => false,
            'font-style'  => false,
            'font-weight'  => false,
            'letter-spacing' => false,
            'text-align' => false,
            'units'       =>'px',
            'subtitle'    => __('Typography for Main Menu (Hover & Active).', 'PixelEmu'),
            'default'     => array(
                'color'       => '#db7833'
            ),
        ),
        array(
            'id'          => 'mainmenu-mobile-typography',
            'type'        => 'typography', 
            'title'       => __('Main Menu Mobile', 'PixelEmu'),
            'google'      => false, 
            'font-size' => false,
            'font-family' => false,
            'font-backup' => false,
            'text-transform' => false,
            'line-height' => false,
            'font-style'  => false,
            'font-weight'  => false,
            'letter-spacing' => false,
            'text-align' => false,
            'units'       =>'px',
            'subtitle'    => __('Typography for Main Menu Mobile.', 'PixelEmu'),
            'default'     => array(
                'color'       => '#c2c2c2'
            ),
        ),
    )
) );

Redux::setSection( $opt_name, array(
    'title'      => __( 'Rooms, Posts and Pages', 'PixelEmu' ),
    'id'         => 'posts-and-pages',
    'fields'     => array(
        array( 
            'id'       => 'front-page-post-raw',
            'type'     => 'raw',
            'title'    => __('Front Page - Post', 'PixelEmu'),
            'desc'     => __('Options for Front Page - Post.', 'PixelEmu'),
        ),
        array(
            'id'       => 'font-sizer-front',
            'type'     => 'switch', 
            'title'    => __('Font Sizer', 'PixelEmu'),
            'subtitle' => __('Enable/disable the font size switcher in Front Page. It is displayed above the content area.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'       => 'page-title-front',
            'type'     => 'switch', 
            'title'    => __('Front Page Title', 'PixelEmu'),
            'subtitle' => __('Show/hide Page Title when static page is used as front page.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'   =>'divider-2',
            'type' => 'divide'
        ),
        array( 
            'id'       => 'room-raw',
            'type'     => 'raw',
            'title'    => __('Room', 'PixelEmu'),
            'desc'     => __('Options for Room.', 'PixelEmu'),
        ),
        array(
            'id'       => 'breadcrumb-room',
            'type'     => 'switch', 
            'title'    => __('Breadcrumb', 'PixelEmu'),
            'subtitle' => __('Enable/disable Breadcrumb in Room.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'font-sizer-room',
            'type'     => 'switch', 
            'title'    => __('Font Sizer', 'PixelEmu'),
            'subtitle' => __('Enable/disable the font size switcher in Room. It is displayed above the content area.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'       => 'post-info-room',
            'type'     => 'switch', 
            'title'    => __('Post Info', 'PixelEmu'),
            'subtitle' => __('Show/Hide post info (ex. post date, category, author) in Room.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'tags-room',
            'type'     => 'switch', 
            'title'    => __('Tags', 'PixelEmu'),
            'subtitle' => __('Show/Hide tags in Room.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'author-info-room',
            'type'     => 'switch', 
            'title'    => __('Author Info', 'PixelEmu'),
            'subtitle' => __('Show/Hide Author info (ex: avatar, bio, website) under content in Room.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'comments-room',
            'type'     => 'switch', 
            'title'    => __('Comments', 'PixelEmu'),
            'subtitle' => __('Show/Hide comments for all Rooms.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'   =>'divider-3',
            'type' => 'divide'
        ),
        array( 
            'id'       => 'single-post-raw',
            'type'     => 'raw',
            'title'    => __('Single Post', 'PixelEmu'),
            'desc'     => __('Options for Single Post.', 'PixelEmu'),
        ),
        array(
            'id'       => 'breadcrumb-post',
            'type'     => 'switch', 
            'title'    => __('Breadcrumb', 'PixelEmu'),
            'subtitle' => __('Enable/disable Breadcrumb in Single Post.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'font-sizer-post',
            'type'     => 'switch', 
            'title'    => __('Font Sizer', 'PixelEmu'),
            'subtitle' => __('Enable/disable the font size switcher in Single Post. It is displayed above the content area.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'       => 'post-info-post',
            'type'     => 'switch', 
            'title'    => __('Post Info', 'PixelEmu'),
            'subtitle' => __('Show/Hide post info (ex. post date, category, author) in single posts.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'tags-post',
            'type'     => 'switch', 
            'title'    => __('Tags', 'PixelEmu'),
            'subtitle' => __('Show/Hide tags in sigle post.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'author-info-post',
            'type'     => 'switch', 
            'title'    => __('Author Info', 'PixelEmu'),
            'subtitle' => __('Show/Hide Author info (ex: avatar, bio, website) under content in single posts.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'comments-post',
            'type'     => 'switch', 
            'title'    => __('Comments', 'PixelEmu'),
            'subtitle' => __('Show/Hide comments for all single posts.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'   =>'divider-4',
            'type' => 'divide'
        ),
        array( 
            'id'       => 'single-page-raw',
            'type'     => 'raw',
            'title'    => __('Single Page', 'PixelEmu'),
            'desc'     => __('Options for Single Page.', 'PixelEmu'),
        ),
        array(
            'id'       => 'breadcrumb-page',
            'type'     => 'switch', 
            'title'    => __('Breadcrumb', 'PixelEmu'),
            'subtitle' => __('Enable/disable Breadcrumb in Pages.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'       => 'font-sizer-page',
            'type'     => 'switch', 
            'title'    => __('Font Sizer', 'PixelEmu'),
            'subtitle' => __('Enable/disable the font size switcher in Pages. It is displayed above the content area.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'       => 'comments-page',
            'type'     => 'switch', 
            'title'    => __('Comments', 'PixelEmu'),
            'subtitle' => __('Show/Hide comments for all Pages.', 'PixelEmu'),
            'default'  => false,
        ),
    )
) );

Redux::setSection( $opt_name, array(
    'title'      => __( 'Layout', 'PixelEmu' ),
    'id'         => 'layout',
    'fields'     => array(
        array(
            'id'       => 'theme-width',
            'type'     => 'dimensions',
            'height'   => false,
            'units'    => 'px',
            'title'    => __('Theme Width', 'PixelEmu'),
            'subtitle' => __('Enter the theme width.', 'PixelEmu'),
            'default'  => array(
                'width'   => '960px'
            ),
        ),

            'id'       => 'off-canavs-width',
            'type'     => 'dimensions',
            'height'   => false,
            'units'    => array('px'),
            'title'    => __('Off-Canvas Width', 'PixelEmu'),
            'subtitle' => __('Enter the Off-Canvas width.', 'PixelEmu'),
            'default'  => array(
                'width'   => '300'
            ),

        array(
            'id'       => 'left-column-width',
            'type'     => 'select',
            'title'    => __('Left Column Width', 'PixelEmu'), 
            'subtitle' => __('Left column width in percents.', 'PixelEmu'),
            'options'  => array(
                '1' => '8%',
                '2' => '17%',
                '3' => '25%',
                '4' => '33%',
                '5' => '42%',
                '6' => '50%',
                '7' => '58%',
                '8' => '67%',
                '9' => '75%',
                '10' => '83%'
            ),
            'default'  => '4',
        ),
        array(
            'id'       => 'right-column-width',
            'type'     => 'select',
            'title'    => __('Right Column Width', 'PixelEmu'), 
            'subtitle' => __('Right column width in percents.', 'PixelEmu'),
            'options'  => array(
                '1' => '8%',
                '2' => '17%',
                '3' => '25%',
                '4' => '33%',
                '5' => '42%',
                '6' => '50%',
                '7' => '58%',
                '8' => '67%',
                '9' => '75%',
                '10' => '83%'
            ),
            'default'  => '4',
        ),
        array(
            'id'       => 'frontpage-layout',
            'type'     => 'image_select',
            'title'    => __('Frontpage Layout', 'PixelEmu'), 
            'subtitle' => __('Layout for frontpage - number of columns and arrangement of them.', 'PixelEmu'),
            'options'  => array(
                '1'      => array(
                    'alt'   => __('2 Column Left', 'PixelEmu'),
                    'img'   => ReduxFramework::$_url.'assets/img/2cl.png'
                ),
                '2'      => array(
                    'alt'   => __('2 Column Right', 'PixelEmu'),
                    'img'  => ReduxFramework::$_url.'assets/img/2cr.png'
                ),
                '3'      => array(
                    'alt'   => __('1 Column', 'PixelEmu'),
                    'img'   => ReduxFramework::$_url.'assets/img/1col.png'
                ),
                '4'      => array(
                    'alt'   => __('3 Column Middle', 'PixelEmu'),
                    'img'   => ReduxFramework::$_url.'assets/img/3cm.png'
                ),
                '5'      => array(
                    'alt'   => __('3 Column Left', 'PixelEmu'),
                    'img'   => ReduxFramework::$_url.'assets/img/3cl.png'
                ),
                '6'      => array(
                    'alt'  => __('3 Column Right', 'PixelEmu'),
                    'img'  => ReduxFramework::$_url.'assets/img/3cr.png'
                )
            ),
            'default' => '2'
        ),
        array(
            'id'       => 'subpage-layout',
            'type'     => 'image_select',
            'title'    => __('Subpage Layout', 'PixelEmu'), 
            'subtitle' => __('Layout for subpage - number of columns and arrangement of them.', 'PixelEmu'),
            'options'  => array(
                '1'      => array(
                    'alt'   => __('2 Column Left', 'PixelEmu'),
                    'img'   => ReduxFramework::$_url.'assets/img/2cl.png'
                ),
                '2'      => array(
                    'alt'   => __('2 Column Right', 'PixelEmu'),
                    'img'  => ReduxFramework::$_url.'assets/img/2cr.png'
                ),
                '3'      => array(
                    'alt'   => __('1 Column', 'PixelEmu'),
                    'img'   => ReduxFramework::$_url.'assets/img/1col.png'
                ),
                '4'      => array(
                    'alt'   => __('3 Column Middle', 'PixelEmu'),
                    'img'   => ReduxFramework::$_url.'assets/img/3cm.png'
                ),
                '5'      => array(
                    'alt'   => __('3 Column Left', 'PixelEmu'),
                    'img'   => ReduxFramework::$_url.'assets/img/3cl.png'
                ),
                '6'      => array(
                    'alt'  => __('3 Column Right', 'PixelEmu'),
                    'img'  => ReduxFramework::$_url.'assets/img/3cr.png'
                )
            ),
            'default' => '4'
        ),
    )
) );

Redux::setSection( $opt_name, array(
    'title'      => __( 'Default Blog Layout', 'PixelEmu' ),
    'id'         => 'default-blog-layout',
    'fields'     => array(
        array( 
            'id'       => 'blog-raw',
            'type'     => 'raw',
            'title'    => __('BLOG', 'PixelEmu'),
            'desc'     => __('Options for Blog Layout.', 'PixelEmu'),
        ),
        array(
            'id'       => 'frontpage-blog-layout',
            'type'     => 'select',
            'title'    => __('Frontpage Blog Layout', 'PixelEmu'), 
            'subtitle' => __('Choose the layout.', 'PixelEmu'),
            'desc'     => __('1 column: 1 post in a row<br />2 columns: 2 posts in a row', 'PixelEmu'),
            'options'  => array(
                '1' => '1 column',
                '2' => '2 columns'
            ),
            'default'  => '1',
        ),
        array(
            'id'       => 'font-sizer-blog',
            'type'     => 'switch', 
            'title'    => __('Font Sizer', 'PixelEmu'),
            'subtitle' => __('Enable/disable the font size switcher. It is displayed above the content area.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'       => 'post-info-blog',
            'type'     => 'switch', 
            'title'    => __('Post Info', 'PixelEmu'),
            'subtitle' => __('Turn on or turn off post info (category, created date).', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'post-thumbnail-blog',
            'type'     => 'switch', 
            'title'    => __('Post Thumbnail', 'PixelEmu'),
            'subtitle' => __('Show/Hide post thumbnails in Blog View.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'readme-blog',
            'type'     => 'switch', 
            'title'    => __('Readmore', 'PixelEmu'),
            'subtitle' => __('Show/Hide readmore text in Blog View.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'   =>'divider-1',
            'type' => 'divide'
        ),
        array( 
            'id'       => 'archive-raw',
            'type'     => 'raw',
            'title'    => __('ARCHIVE', 'PixelEmu'),
            'desc'     => __('Options for Archive Layout (Category, Tag, Author, Day, Moth, Year View).', 'PixelEmu'),
        ),
        array(
            'id'       => 'subpage-blog-layout',
            'type'     => 'select',
            'title'    => __('Subpage Blog Layout', 'PixelEmu'), 
            'subtitle' => __('Choose the layout.', 'PixelEmu'),
            'desc'     => __('1 column: 1 post in a row<br />2 columns: 2 posts in a row', 'PixelEmu'),
            'options'  => array(
                '1' => '1 column',
                '2' => '2 columns'
            ),
            'default'  => '2',
        ),
        array(
            'id'       => 'breadcrumb-archive',
            'type'     => 'switch', 
            'title'    => __('Breadcrumbs', 'PixelEmu'),
            'subtitle' => __('Turn on or turn off breadcrumbs.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'font-sizer-archive',
            'type'     => 'switch', 
            'title'    => __('Font Sizer', 'PixelEmu'),
            'subtitle' => __('Enable/disable the font size switcher. It is displayed above the content area.', 'PixelEmu'),
            'default'  => false,
        ),
        array(
            'id'       => 'header-title-archive',
            'type'     => 'switch', 
            'title'    => __('Header Title', 'PixelEmu'),
            'subtitle' => __('Show/Hide header title (ex: All posts in category Peace) in Archive (Category, Tags, Date etc).', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'post-info-archive',
            'type'     => 'switch', 
            'title'    => __('Post Info', 'PixelEmu'),
            'subtitle' => __('Turn on or turn off post info (category, created date).', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'post-thumbnail-archive',
            'type'     => 'switch', 
            'title'    => __('Post Thumbnail', 'PixelEmu'),
            'subtitle' => __('Show/Hide post thumbnails in Archive (Category, Tags, Date etc).', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'readme-archive',
            'type'     => 'switch', 
            'title'    => __('Readmore', 'PixelEmu'),
            'subtitle' => __('Show/Hide readmore text in Archive (Category, Tags, Date etc).', 'PixelEmu'),
            'default'  => true,
        ),
    )
) );

Redux::setSection( $opt_name, array(
    'title'      => __( 'Background Colors', 'PixelEmu' ),
    'id'         => 'background-colors',
    'fields'     => array(
        array(
            'id'       => 'main-scheme-color',
            'type'     => 'color',
            'title'    => __('Main scheme color', 'PixelEmu'), 
            'subtitle' => __('Color for buttons, links, pagination etc.', 'PixelEmu'),
            'default'  => '#db7833',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'general-hover-color',
            'type'     => 'color',
            'title'    => __('General Hover Color', 'PixelEmu'), 
            'subtitle' => __('Color for buttons, links, pagination etc. on hover', 'PixelEmu'),
            'default'  => '#c94326',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'page-background',
            'type'     => 'color',
            'title'    => __('Page Background', 'PixelEmu'), 
            'subtitle' => __('Main background color.', 'PixelEmu'),
            'default'  => '#f4f7f9',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'base-border',
            'type'     => 'color',
            'title'    => __('Base Border', 'PixelEmu'), 
            'subtitle' => __('Base Border Color.', 'PixelEmu'),
            'default'  => '#ebedef',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'bar-background',
            'type'     => 'color_rgba',
            'title'    => __('Bar background', 'PixelEmu'),
            'subtitle' => __('Choose the Bar background color.', 'PixelEmu'),
            'default'   => array(
                'color'     => '#000000',
                'alpha'     => 0.6,
                'rgba'      => 'rgba(0, 0, 0, 0.6)',
            )
        ),
        array(
            'id'       => 'bar-background-scrolled',
            'type'     => 'color_rgba',
            'title'    => __('Bar background after scroll', 'PixelEmu'),
            'subtitle' => __('Choose the Bar background color after scroll.', 'PixelEmu'),
            'default'   => array(
                'color'     => '#000000',
                'alpha'     => 1,
                'rgba'      => 'rgba(0, 0, 0, 1)',
            )
        ),
        array(
            'id'       => 'bar-text',
            'type'     => 'color',
            'title'    => __('Bar text color', 'PixelEmu'), 
            'subtitle' => __('Choose the Top Bar text color.', 'PixelEmu'),
            'default'  => '#ffffff',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'header-background',
            'type'     => 'color',
            'title'    => __('Header Background', 'PixelEmu'), 
            'subtitle' => __('Choose the Header background color.', 'PixelEmu'),
            'default'  => '#f4f7f9',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'header-text',
            'type'     => 'color',
            'title'    => __('Header Text', 'PixelEmu'), 
            'subtitle' => __('Choose the Header text color.', 'PixelEmu'),
            'default'  => '#212121',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'top-bar-background',
            'type'     => 'color',
            'title'    => __('Top Bar Background', 'PixelEmu'), 
            'subtitle' => __('Choose the Top Bar background color.', 'PixelEmu'),
            'default'  => '#212121',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'top-bar-text',
            'type'     => 'color',
            'title'    => __('Top Bar Text', 'PixelEmu'), 
            'subtitle' => __('Choose the Top Bar text color.', 'PixelEmu'),
            'default'  => '#ffffff',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'off-canvas-icon',
            'type'     => 'color',
            'title'    => __('Off-Canvas icon', 'PixelEmu'), 
            'subtitle' => __('Choose the off-canvas icon color.', 'PixelEmu'),
            'default'  => '#ffffff',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'off-canvas-background',
            'type'     => 'color',
            'title'    => __('Off-Canvas background.', 'PixelEmu'), 
            'subtitle' => __('Choose off-canvas sidebar background color.', 'PixelEmu'),
            'default'  => '#2a2a2a',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'off-canvas-text',
            'type'     => 'color',
            'title'    => __('Off-Canvas text', 'PixelEmu'), 
            'subtitle' => __('Choose off-canvas sidebar text color.', 'PixelEmu'),
            'default'  => '#c2c2c2',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'off-canvas-widget-title',
            'type'     => 'color',
            'title'    => __('Off-Canvas widget title', 'PixelEmu'), 
            'subtitle' => __('Choose off-canvas sidebar widget title color.', 'PixelEmu'),
            'default'  => '#ffffff',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'footer-background',
            'type'     => 'color',
            'title'    => __('Footer background', 'PixelEmu'), 
            'subtitle' => __('Choose the Footer background color.', 'PixelEmu'),
            'default'  => '#212121',
            'validate' => 'color',
            'transparent' => false
        ),
        array(
            'id'       => 'footer-text',
            'type'     => 'color',
            'title'    => __('Footer Text', 'PixelEmu'), 
            'subtitle' => __('Choose the Footer text color.', 'PixelEmu'),
            'default'  => '#ffffff',
            'validate' => 'color',
            'transparent' => false
        ),
    )
) );

Redux::setSection( $opt_name, array(
    'title'      => __( 'Fonts', 'PixelEmu' ),
    'id'         => 'fonts',
    'fields'     => array(
        array(
            'id'          => 'body-typography',
            'type'        => 'typography', 
            'title'       => __('Body Typography', 'PixelEmu'),
            'google'      => true, 
            'font-backup' => true,
            'text-transform' => true,
            'line-height' => false,
            'font-style'  => true,
            'font-weight'  => true,
            'letter-spacing' => true,
            'text-align' => false,
            'units'       =>'px',
            'subtitle'    => __('Typography for BODY.', 'PixelEmu'),
            'default'     => array(
                'color'       => '#212121', 
                'font-weight'  => '400',
                'letter-spacing' => 'normal',
                'text-transform' => 'none',
                'font-family' => 'Open Sans',
                'font-backup' => 'Arial, Helvetica, sans-serif',
                'google'      => true,
                'font-size'   => '15px'
            ),
        ),
        array(
            'id'          => 'post-titles',
            'type'        => 'typography', 
            'title'       => __('Post Titles', 'PixelEmu'),
            'google'      => true, 
            'font-backup' => true,
            'text-transform' => true,
            'line-height' => false,
            'font-style'  => true,
            'font-weight'  => true,
            'letter-spacing' => true,
            'text-align' => false,
            'units'       =>'px',
            'subtitle'    => __('Typography for post titles.', 'PixelEmu'),
            'default'     => array(
                'color'       => '#212121', 
                'font-weight'  => '700',
                'letter-spacing' => 'normal',
                'text-transform' => 'uppercase',
                'font-family' => 'Open Sans',
                'font-backup' => 'Arial, Helvetica, sans-serif',
                'google'      => true,
                'font-size'   => '30px'
            ),
        ),
        array(
            'id'          => 'widgets-titles',
            'type'        => 'typography', 
            'title'       => __('Widgets Titles', 'PixelEmu'),
            'google'      => true, 
            'font-backup' => true,
            'text-transform' => true,
            'line-height' => false,
            'font-style'  => true,
            'font-weight'  => true,
            'letter-spacing' => true,
            'text-align' => false,
            'units'       =>'px',
            'subtitle'    => __('Typography for widget titles.', 'PixelEmu'),
            'default'     => array(
                'color'       => '#000000', 
                'font-weight'  => '700',
                'letter-spacing' => 'normal',
                'text-transform' => 'uppercase',
                'font-family' => 'Open Sans',
                'font-backup' => 'Arial, Helvetica, sans-serif',
                'google'      => true,
                'font-size'   => '18px'
            ),
        ),
    )
) );

Redux::setSection( $opt_name, array(
    'title'      => __( 'Footer', 'PixelEmu' ),
    'id'         => 'footer',
    'fields'     => array(
        array(
            'id'=>'copyright-info-text',
            'type' => 'textarea',
            'title' => __('Copyright Info', 'PixelEmu'), 
            'subtitle' => __('Add text for copyright info at the bottom of the page.', 'PixelEmu'),
            'validate' => 'html_custom',
            'default' => 'PE Hotel All Rights Reserved',
            'allowed_html' => array(
                'a' => array(
                    'href' => array(),
                    'title' => array()
                ),
                'br' => array(),
                'em' => array(),
                'strong' => array()
            )
        ),
        array(
            'id'       => 'copyright-info',
            'type'     => 'switch', 
            'title'    => '',
            'subtitle' => __('Turn on or turn off copyright info.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'pixelemu-copyright',
            'type'     => 'switch', 
            'title'    => '',
            'subtitle' => __('Turn on or turn off PixelEmu copyright.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'social-icons',
            'type'     => 'switch', 
            'title'    => '',
            'subtitle' => __('Turn on or turn off social icons.', 'PixelEmu'),
            'default'  => true,
        ),
        array(
            'id'       => 'social-facebook',
            'type'     => 'text',
            'title'    => __('Facebook Profile URL', 'PixelEmu'),
            'subtitle' => __('Enter the Facebook Profile URL.', 'PixelEmu'),
            'default'  => '',
            'validate' => 'url'
        ),
        array(
            'id'       => 'social-twitter',
            'type'     => 'text',
            'title'    => __('Twitter Profile URL', 'PixelEmu'),
            'subtitle' => __('Enter the Twitter Profile URL.', 'PixelEmu'),
            'default'  => '',
            'validate' => 'url'
        ),
        array(
            'id'       => 'social-googleplus',
            'type'     => 'text',
            'title'    => __('Google Plus Profile URL', 'PixelEmu'),
            'subtitle' => __('Enter the Google Plus Profile URL.', 'PixelEmu'),
            'default'  => '',
            'validate' => 'url'
        ),
    )
) );

Redux::setSection( $opt_name, array(
    'title'      => __( 'Advanced', 'PixelEmu' ),
    'id'         => 'advanced',
    'fields'     => array(
        array(
            'id'=>'custom-code-into-the-head-section',
            'type' => 'textarea',
            'title' => __('Custom Code Into The HEAD Section', 'PixelEmu'), 
            'subtitle' => __('Add custom code into the HEAD section if needed. Please put code inside script tags.', 'PixelEmu'),
            'default' => '',
        ),
        array(
            'id'=>'javascript-code-before-the-body-tag',
            'type' => 'textarea',
            'title' => __('Javascript Code Before The </BODY> Tag', 'PixelEmu'), 
            'subtitle' => __('This code will be inserted right before closing the BODY tag. Please put code inside script tags. Paste here Google Analytics Scripts, Google Re-marketing Tag, Google Webmaster Tools, etc.', 'PixelEmu'),
            'default' => '',
        ),
        array(
            'id'       => 'google-analytics-id',
            'type'     => 'text',
            'title'    => __('Google Analytics ID', 'PixelEmu'),
            'subtitle' => __('e.g. UA-XXXXX-Y or UA-XXXXX-YY', 'PixelEmu'),
        ),
        array(
            'id'       => 'google-webmaster-tools-site-verification',
            'type'     => 'text',
            'title'    => __('Google Webmaster Tools Site Verification', 'PixelEmu'),
            'subtitle' => __('Please insert verification code for Webmaster tools in here.', 'PixelEmu'),
        ),
        array(
            'id'       => 'addthis-code',
            'type'     => 'text',
            'title'    => __('Addthis code', 'PixelEmu'),
            'subtitle' => __('Enter your Addthis Public ID to display social icons. You need to set up <strong>Sharing Buttons</strong> in your Addthis account. Recommended: small size.', 'PixelEmu'),
        ),
    )
) );

/*
 * <--- END SECTIONS
 */

`

Should i add your code afer my code?

Best Regards ML

dovy commented 8 years ago

Yes, after.

mlyczko commented 8 years ago

Hi

I've tried it. Without luck.

Best Regards ML

dovy commented 8 years ago

Sorry my friend, you need to tinker with it a bit. We can show you the way, but we can't dig into your code directly unless you grab some premium support. This is open source after all. :)

But I promise, the code I have will get you close. I imagine it's a problem with the priority of things loading. Try doing an echo and an exit in that function to see if it properly fires. Then try and see if ReduxFramework the class even exists. :)