函数文档

options_reading_add_js()

💡 云策文档标注

概述

options_reading_add_js() 函数用于在页面中显示 JavaScript,是 WordPress 核心功能的一部分。

关键要点

  • 函数名称:options_reading_add_js()
  • 主要用途:在页面上输出 JavaScript 代码
  • 引入版本:WordPress 3.5.0
  • 相关资源:可通过 View all references、View on Trac、View on GitHub 查看详细文档和源码

📄 原文内容

Display JavaScript on the page.

Source

function options_reading_add_js() {
	?>

	jQuery( function($) {
		var section = $('#front-static-pages'),
			staticPage = section.find('input:radio[value="page"]'),
			selects = section.find('select'),
			check_disabled = function(){
				selects.prop( 'disabled', ! staticPage.prop('checked') );
			};
		check_disabled();
		section.find( 'input:radio' ).on( 'change', check_disabled );
	} );

	

Changelog

Version Description
3.5.0 Introduced.