3

I have fall a problem to make stylesheet dynamic by redux. In my config.php I have write this code.

array(
    'id'        => 'scheme',
    'type'      => 'select',
    'title'     => __('Theme Stylesheet', 'redux-framework-demo'),
    'subtitle'  => __('Select a predefined color scheme. They`re located in `/css/color-schemes/` theme folder', 'redux-framework-demo'),
    'options'   => array('orange.css' => 'orange.css', 'red.css' => 'red.css', 'blue.css' => 'blue.css'),
    'default'   => 'orange.css',
),

and I have tried to enqueue stylesheet by writting bellow code on functions.php

if(!isset($redux_demo['scheme'])) {
    wp_enqueue_style( 'pm-color-scheme', get_stylesheet_directory_uri() . '/css/color-schemes/orange.css' );
}
else {
    wp_enqueue_style( 'pm-color-scheme', get_stylesheet_directory_uri() . '/css/color-schemes/'.$redux_demo['scheme'] );
}

But when I select blue.css from theme option like this http://prntscr.com/3s5td0

I get default value that is orange.css everytime like this http://prntscr.com/3s5ucm.

what can I do now?

Shehary
  • 9,548
  • 9
  • 33
  • 66
BizedKhan
  • 624
  • 5
  • 12
  • are you adding that enqueue style to an action? Such as: add_action('wp_enqueue_scripts', 'my_scripts'); – Calvin deClaisse-Walford Jun 12 '14 at 18:40
  • yes, I have used this code bellow – BizedKhan Jun 12 '14 at 19:13
  • if( !function_exists('delicious_enqueue_scripts') ) { add_action('wp_enqueue_scripts','delicious_enqueue_scripts'); function delicious_enqueue_scripts() { if(!isset($redux_demo['scheme'])) { wp_enqueue_style( 'pm-color-scheme', get_stylesheet_directory_uri() . '/css/color-schemes/orange.css' ); } else { wp_enqueue_style( 'pm-color-scheme', get_stylesheet_directory_uri() . '/css/color-schemes/'.$redux_demo['scheme'] ); } } } – BizedKhan Jun 12 '14 at 19:15

1 Answers1

1

$redux_demo won't work until after your Redux Config has been run. Make sure you run it first.

Dovy
  • 1,210
  • 9
  • 18