i need to show the widget based on user location , for a testing purpose i have created the by using following code
if( function_exists( 'register_sidebar' ) )
register_sidebar( array( 'name'=>'Madurai-Right',
'before_widget' => '<div class="widget relativ">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
) );
and getting the widget like below
<?php $city="Madurai"; echo $side_bar= "'$city-Right'"; ?>
<?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar($side_bar) ) :?>
<?php endif; ?>
Here city is the location, so based on the location i am getting the sidebar as dynamic_sidebar($side_bar) it doesn't working
But if i use without the variable ase dynamic_sidebar('Madurai-Right') is working well, any idea? what is wrong with my code ?