function partners($atts ) {
extract(shortcode_atts(array(
'ids' => null,
'extra_options' => 'something' <----------------- in wordpress I can read this value using local $extra_options
), $atts));
global $extra_options; <----------------- trying to change local var to global
function print_partners_scripts() {
global $extra_options; <----------------- reading above variable
echo '<script type="text/javascript">' . "
";
echo 'jQuery(document).ready( function() {'. "
";
echo ' $(".partners-slider").bxSlider({
slideWidth: 924,
auto: 0,
autoStart: 0,
moveSlides: 1,
minSlides: 3,
maxSlides: 8,
pager: false,
controls: false,
slideMargin: 5,
' . $extra_options . ' <----------------- var is empty
});' . "
";
echo '});' . "
";
echo '</script>' . "
";
}
add_action( 'wp_footer', 'print_partners_scripts' );
$ids = explode( ',', $ids );
$output = '<div class="ps-wrap"><div class="partners-slider">';
foreach($ids as $id) {
$img_attr = wp_get_attachment_image_src( $id, 'full' );
$output .= '<div class="pslide"><img src="' . $img_attr[0] . '" /></div>';
}
$output .= '</div></div>';
return $output;
}
Hi, I'm trying to read var $extra_options inside print_partners_scripts(). The variable is set in the partners() function. I've tried to make it global and simply use it in certain place but I guess I'm doing something wrong ;)
Thanks in advance !