Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Solved it :D I use the variable directly within the Javascript scope. Here is the code (just in case)</p> <pre><code>function mytheme_flexslider() { if (!is_admin()) { // Enqueue FlexSlider JavaScript wp_register_script('jquery_flexslider', get_template_directory_uri(). '/js/jquery.flexslider-min.js', array('jquery') ); wp_enqueue_script('jquery_flexslider'); // Enqueue FlexSlider Stylesheet wp_register_style( 'flexslider-style', get_template_directory_uri() . '/inc/flexslider/flexslider.css', 'all' ); wp_enqueue_style( 'flexslider-style' ); // FlexSlider custom settings add_action('wp_footer', 'mytheme_flexslider_settings'); function mytheme_flexslider_settings() { // Fetch options data **global $smof_data;?&gt;** &lt;script&gt; // Can also be used with $(document).ready() // flexslider have a fixed height jQuery(window).load(function() { // jQuery('.subhead_shadow_bottom').hide(); jQuery('.flexslider').flexslider({ controlNav: true, directionNav: true, prevText: 'Previous', nextText: 'Next', animation: "&lt;?php echo $smof_data['slider_animation']; ?&gt;", animationLoop: false // animation: "slide" }); }); jQuery(document).ready(function() { fixFlexsliderHeight(); }); jQuery(window).load(function() { fixFlexsliderHeight(); }); // BUG: this ends up computing the slide height to the image height, not to the resized height, on page reload jQuery(window).resize(function() { fixFlexsliderHeight(); }); function fixFlexsliderHeight() { // Set fixed height based on the tallest slide jQuery('.flexslider').each(function(){ var sliderHeight = 0; jQuery(this).find('.slides &gt; li').each(function(){ slideHeight = jQuery(this).height(); if (sliderHeight &lt; slideHeight) { sliderHeight = slideHeight; } }); // jQuery(this).find('ul.slides').css({'height' : sliderHeight}); // console.log("Fixing slider height to " + sliderHeight); }); } // jQuery(document).ready(function($){ // $('.flexslider').flexslider(); // }); &lt;/script&gt; &lt;?php **// return $smof_data;** } } } add_action('init', 'mytheme_flexslider'); </code></pre> <p>All are working now. Maybe one little question: Do I need to return $smof_data (the second bold-ed part)? It works both ways.. I need to learn more about varible scopes..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload