Disable static page dropdowns when 'latest posts' is selected on Settings > Reading. props koopersmith, fixes #15205.

git-svn-id: http://svn.automattic.com/wordpress/trunk@15946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-10-24 19:20:52 +00:00
parent f714463866
commit d682c0b03d
2 changed files with 28 additions and 2 deletions

View File

@ -21,7 +21,7 @@ $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
* Display JavaScript on the page. * Display JavaScript on the page.
* *
* @package WordPress * @package WordPress
* @subpackage General_Settings_Panel * @subpackage General_Settings_Screen
*/ */
function add_js() { function add_js() {
?> ?>
@ -56,7 +56,7 @@ function add_js() {
</script> </script>
<?php <?php
} }
add_filter('admin_head', 'add_js'); add_action('admin_head', 'add_js');
add_contextual_help($current_screen, add_contextual_help($current_screen,
'<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' . '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' .

View File

@ -15,6 +15,32 @@ if ( ! current_user_can( 'manage_options' ) )
$title = __( 'Reading Settings' ); $title = __( 'Reading Settings' );
$parent_file = 'options-general.php'; $parent_file = 'options-general.php';
/**
* Display JavaScript on the page.
*
* @package WordPress
* @subpackage Reading_Settings_Screen
*/
function add_js() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
var section = $('#front-static-pages'),
staticPage = section.find('input:radio[value="page"]'),
selects = section.find('select'),
check_disabled = function(){
selects.attr('disabled', staticPage.is(':checked') ? 'disabled' : '');
};
check_disabled();
section.find('input:radio').change(check_disabled);
});
//]]>
</script>
<?php
}
add_action('admin_head', 'add_js');
add_contextual_help($current_screen, add_contextual_help($current_screen,
'<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' . '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
'<p>' . sprintf(__('You can choose what&#8217;s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' . '<p>' . sprintf(__('You can choose what&#8217;s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' .