wc_print_js

Output any queued javascript code in the footer.

Description

wc_print_js(); 

Usage

  1. if ( !function_exists( 'wc_print_js' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wc_print_js(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-core-functions.php  
  1. function wc_print_js() { 
  2. global $wc_queued_js; 
  3.  
  4. if ( ! empty( $wc_queued_js ) ) { 
  5. // Sanitize. 
  6. $wc_queued_js = wp_check_invalid_utf8( $wc_queued_js ); 
  7. $wc_queued_js = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", $wc_queued_js ); 
  8. $wc_queued_js = str_replace( "\r", '', $wc_queued_js ); 
  9.  
  10. $js = "<!-- WooCommerce JavaScript -->\n<script type=\"text/javascript\">\njQuery(function($) { $wc_queued_js });\n</script>\n"; 
  11.  
  12. /** 
  13. * woocommerce_queued_js filter. 
  14. * @since 2.6.0 
  15. * @param string $js JavaScript code. 
  16. */ 
  17. echo apply_filters( 'woocommerce_queued_js', $js ); 
  18.  
  19. unset( $wc_queued_js );