Wordpress dynamic widget by location? -


i need show widget based on user location , testing purpose have created 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 widget below

<?php $city="madurai";  echo $side_bar= "'$city-right'"; ?>     <?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar($side_bar) ) :?>     &nbsp;     <?php endif; ?> 

here city location, based on location getting sidebar dynamic_sidebar($side_bar) doesn't working

but if use without variable inside dynamic_sidebar('madurai-right') working well, idea? wrong code ?

dude replace $side_bar= "'$city-right'" $side_bar= $city."-right"


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -