options_reading_add_js

Display JavaScript on the page.

Description

options_reading_add_js(); 

Usage

  1. if ( !function_exists( 'options_reading_add_js' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/options.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = options_reading_add_js(); 
  7.  

Defined (1)

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

/wp-admin/includes/options.php  
  1. function options_reading_add_js() { 
  2. ?> 
  3. <script type="text/javascript"> 
  4. jQuery(document).ready(function($) { 
  5. var section = $('#front-static-pages'),  
  6. staticPage = section.find('input:radio[value="page"]'),  
  7. selects = section.find('select'),  
  8. check_disabled = function() { 
  9. selects.prop( 'disabled', ! staticPage.prop('checked') ); 
  10. }; 
  11. check_disabled(); 
  12. section.find('input:radio').change(check_disabled); 
  13. }); 
  14. </script> 
  15. <?php