Dynamically switch file in get_template_directory_uri() | Function
I need to switch scheme color of my WordPress theme trough Redux option panel.
My plan is switch the CSS file trough get_template_directory_uri() | Function.
The scenario is:
Create 2 scheme color: dark and light with dark.css and libght.css.
Control from redux panel with this code:
?php Redux::setSection( $opt_name, array( 'title' = __( 'Color Scheme', 'javapaper' ), 'id' = 'test_scheme', 'icon' = 'el el-list', 'fields' = array( array( 'id' = 'color_scheme', 'type' = 'image_select', 'title' = __( 'SELECT Color Scheme', 'javapaper' ), 'subtitle' = __( '2 scheme Available', 'javapaper' ), 'options' = array( 'dark' = array( 'title' = 'dark', 'alt' = 'dark', 'img' = get_stylesheet_directory_uri() . '/images/header-styledefault.png' ), 'light' = array( 'title' = 'light', 'alt' = 'light', 'img' = get_stylesheet_directory_uri() . '/images/header-style2.png' ) ), 'default' = 'dark' ), ) ) ); ?
Call the code from Redux panel into get_template_directory_uri() | Function like this:
wp_enqueue_style( 'javapaper-lightbox-style', get_template_directory_uri() . '/css/$redux_demo[color_scheme]' );
But Unfortunately It did not work. I am newbie on php. Please help.
Topic theme-options functions php theme-development themes Wordpress
Category Web