Show multiple option in URL with Redux framework in front end
I'm creating a WordPress theme in which I'm using the Redux Framework for creating the theme's options page.
I want to show multiple blog layouts without creating custom WP templates. I saw in many themes the URL is something like
- theme.com?home_layout=gridsidebar=left
- theme.com?home_layout=listsidebar=none
Now in the theme-option file i've got this one for the sidebar:
array(
'id' = 'sidebar_position',
'type' = 'select',
'title' = esc_html__( 'Blog sidebar', 'omio' ),
'options' = array(
'left' = esc_html__('Left', 'omio'),
'right' = esc_html__('Right', 'omio'),
'disable' = esc_html__('Disable', 'omio'),
),
'default' = 'right' ),
Now in the functions.php i've made a GET request code but didn't work.
$sidebar = isset( $_GET['sidebar_position'] ) ? $_GET['sidebar_position'] : 'right';
switch ( $sidebar ) {
case 'left':
set_theme_mod( 'sidebar_position', 'left' );
break;
case 'disable':
set_theme_mod( 'sidebar_position', 'disable' );
break;
default:
set_theme_mod( 'sidebar_position', 'right' ); }
How to do it, please :) for example when I put the sidebar at the left (theme.com/?sidebar=left) nothing happen, sidebar stay by default at the right
Topic theme-options framework Wordpress
Category Web