Печать строки в нижний колонтитул с использованием параметра wp_footer

add_action('wp_footer','slider_option'); function slider_option() { $option ="<script>script function data </script>"; echo $option; } 

Я хочу напечатать или вы можете сказать вставить данные в переменную $option в нижнее меню

Какие-либо предложения?

Вам нужно использовать переменную для вашего скрипта?

Я делал это в прошлом и работал …

 // add script to the footer and break out of PHP function slider_option(){ ?> <script>script function data</script> <?php } ?> add_action('wp_footer','slider_option'); 

Если это не работает, убедитесь, что у вас есть нижний колонтитул в вашем файле шаблона нижнего колонтитула.

 <?php wp_footer(); ?> 
 adding wp_footer() hook inside theme and then this code to add script to footer and worked fine for me function slider_option() { $default=array( 'effect'=> 'random', // Specify sets like: 'fold,fade,sliceDown' 'slices'=> 15, // For slice animations 'boxCols'=> 8, // For box animations 'boxRows'=> 4, // For box animations 'animSpeed'=> 500, // Slide transition speed 'pauseTime'=> 3000, // How long each slide will show 'startSlide'=> 0, // Set starting Slide (0 index) 'directionNav'=> true, // Next & Prev navigation 'controlNav'=> true, // 1,2,3... navigation 'controlNavThumbs'=> false, // Use thumbnails for Control Nav 'pauseOnHover'=> false, // Stop animation while hovering 'manualAdvance'=> false, // Force manual transitions 'prevText'=> 'Prev', // Prev directionNav text 'nextText'=> 'Next', // Next directionNav text 'randomStart'=> false); extract($default); $slider_script; ?> <script type='text/javascript'> $(window).load(function() { $('#slider_slide').nivoSlider({ effect:<?php echo "$effect"; ?>, slices:<?php echo "$slices"; ?>, // For slice animations boxCols:<?php echo "$boxCols"; ?>, // For box animations boxRows:<?php echo "$boxRows" ?>, // For box animations animSpeed:<?php echo "$animSpeed"; ?>, // Slide transition speed pauseTime:<?php echo "$pauseTime"; ?>, // How long each slide will show startSlide:<?php echo "$startSlide"; ?>, // Set starting Slide (0 index) directionNav:<?php echo "$directionNav"; ?>, // Next & Prev navigation controlNav:<?php echo "$controlNav"; ?>, // 1,2,3... navigation controlNavThumbs:<?php echo "$controlNavThumbs"; ?>, // Use thumbnails for Control Nav pauseOnHover:<?php echo "$pauseOnHover"; ?>, // Stop animation while hovering manualAdvance:<?php echo "$manualAdvance"; ?>, // Force manual transitions prevText:<?php echo "$prevText"; ?>, // Prev directionNav text nextText:<?php echo "$nextText"; ?>, // Next directionNav text randomStart:<?php echo "$randomStart"; ?> });}); </script> <?php } add_action('wp_footer','slider_option'); ?> thank you for @mattroyal @reny and others for your help по adding wp_footer() hook inside theme and then this code to add script to footer and worked fine for me function slider_option() { $default=array( 'effect'=> 'random', // Specify sets like: 'fold,fade,sliceDown' 'slices'=> 15, // For slice animations 'boxCols'=> 8, // For box animations 'boxRows'=> 4, // For box animations 'animSpeed'=> 500, // Slide transition speed 'pauseTime'=> 3000, // How long each slide will show 'startSlide'=> 0, // Set starting Slide (0 index) 'directionNav'=> true, // Next & Prev navigation 'controlNav'=> true, // 1,2,3... navigation 'controlNavThumbs'=> false, // Use thumbnails for Control Nav 'pauseOnHover'=> false, // Stop animation while hovering 'manualAdvance'=> false, // Force manual transitions 'prevText'=> 'Prev', // Prev directionNav text 'nextText'=> 'Next', // Next directionNav text 'randomStart'=> false); extract($default); $slider_script; ?> <script type='text/javascript'> $(window).load(function() { $('#slider_slide').nivoSlider({ effect:<?php echo "$effect"; ?>, slices:<?php echo "$slices"; ?>, // For slice animations boxCols:<?php echo "$boxCols"; ?>, // For box animations boxRows:<?php echo "$boxRows" ?>, // For box animations animSpeed:<?php echo "$animSpeed"; ?>, // Slide transition speed pauseTime:<?php echo "$pauseTime"; ?>, // How long each slide will show startSlide:<?php echo "$startSlide"; ?>, // Set starting Slide (0 index) directionNav:<?php echo "$directionNav"; ?>, // Next & Prev navigation controlNav:<?php echo "$controlNav"; ?>, // 1,2,3... navigation controlNavThumbs:<?php echo "$controlNavThumbs"; ?>, // Use thumbnails for Control Nav pauseOnHover:<?php echo "$pauseOnHover"; ?>, // Stop animation while hovering manualAdvance:<?php echo "$manualAdvance"; ?>, // Force manual transitions prevText:<?php echo "$prevText"; ?>, // Prev directionNav text nextText:<?php echo "$nextText"; ?>, // Next directionNav text randomStart:<?php echo "$randomStart"; ?> });}); </script> <?php } add_action('wp_footer','slider_option'); ?> thank you for @mattroyal @reny and others for your help по adding wp_footer() hook inside theme and then this code to add script to footer and worked fine for me function slider_option() { $default=array( 'effect'=> 'random', // Specify sets like: 'fold,fade,sliceDown' 'slices'=> 15, // For slice animations 'boxCols'=> 8, // For box animations 'boxRows'=> 4, // For box animations 'animSpeed'=> 500, // Slide transition speed 'pauseTime'=> 3000, // How long each slide will show 'startSlide'=> 0, // Set starting Slide (0 index) 'directionNav'=> true, // Next & Prev navigation 'controlNav'=> true, // 1,2,3... navigation 'controlNavThumbs'=> false, // Use thumbnails for Control Nav 'pauseOnHover'=> false, // Stop animation while hovering 'manualAdvance'=> false, // Force manual transitions 'prevText'=> 'Prev', // Prev directionNav text 'nextText'=> 'Next', // Next directionNav text 'randomStart'=> false); extract($default); $slider_script; ?> <script type='text/javascript'> $(window).load(function() { $('#slider_slide').nivoSlider({ effect:<?php echo "$effect"; ?>, slices:<?php echo "$slices"; ?>, // For slice animations boxCols:<?php echo "$boxCols"; ?>, // For box animations boxRows:<?php echo "$boxRows" ?>, // For box animations animSpeed:<?php echo "$animSpeed"; ?>, // Slide transition speed pauseTime:<?php echo "$pauseTime"; ?>, // How long each slide will show startSlide:<?php echo "$startSlide"; ?>, // Set starting Slide (0 index) directionNav:<?php echo "$directionNav"; ?>, // Next & Prev navigation controlNav:<?php echo "$controlNav"; ?>, // 1,2,3... navigation controlNavThumbs:<?php echo "$controlNavThumbs"; ?>, // Use thumbnails for Control Nav pauseOnHover:<?php echo "$pauseOnHover"; ?>, // Stop animation while hovering manualAdvance:<?php echo "$manualAdvance"; ?>, // Force manual transitions prevText:<?php echo "$prevText"; ?>, // Prev directionNav text nextText:<?php echo "$nextText"; ?>, // Next directionNav text randomStart:<?php echo "$randomStart"; ?> });}); </script> <?php } add_action('wp_footer','slider_option'); ?> thank you for @mattroyal @reny and others for your help