web/wp-admin/options-reading.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 /** WordPress Administration Bootstrap */
     9 /** WordPress Administration Bootstrap */
    10 require_once('admin.php');
    10 require_once( './admin.php' );
    11 
    11 
    12 if ( ! current_user_can('manage_options') )
    12 if ( ! current_user_can( 'manage_options' ) )
    13 	wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
    13 	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
    14 
    14 
    15 $title = __('Reading Settings');
    15 $title = __( 'Reading Settings' );
    16 $parent_file = 'options-general.php';
    16 $parent_file = 'options-general.php';
    17 
    17 
    18 include('admin-header.php');
    18 /**
       
    19  * Display JavaScript on the page.
       
    20  *
       
    21  * @package WordPress
       
    22  * @subpackage Reading_Settings_Screen
       
    23  */
       
    24 function add_js() {
       
    25 ?>
       
    26 <script type="text/javascript">
       
    27 //<![CDATA[
       
    28 	jQuery(document).ready(function($){
       
    29 		var section = $('#front-static-pages'),
       
    30 			staticPage = section.find('input:radio[value="page"]'),
       
    31 			selects = section.find('select'),
       
    32 			check_disabled = function(){
       
    33 				selects.prop( 'disabled', ! staticPage.prop('checked') );
       
    34 			};
       
    35 		check_disabled();
       
    36  		section.find('input:radio').change(check_disabled);
       
    37 	});
       
    38 //]]>
       
    39 </script>
       
    40 <?php
       
    41 }
       
    42 add_action('admin_head', 'add_js');
       
    43 
       
    44 get_current_screen()->add_help_tab( array(
       
    45 	'id'      => 'overview',
       
    46 	'title'   => __('Overview'),
       
    47 	'content' => '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
       
    48 		'<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>' .
       
    49 		'<p>' . __('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display, whether to show full text or a summary, and the character set encoding.') . '</p>' .
       
    50 		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
       
    51 ) );
       
    52 
       
    53 get_current_screen()->set_help_sidebar(
       
    54 	'<p><strong>' . __('For more information:') . '</strong></p>' .
       
    55 	'<p>' . __('<a href="http://codex.wordpress.org/Settings_Reading_Screen" target="_blank">Documentation on Reading Settings</a>') . '</p>' .
       
    56 	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
       
    57 );
       
    58 
       
    59 include( './admin-header.php' );
    19 ?>
    60 ?>
    20 
    61 
    21 <div class="wrap">
    62 <div class="wrap">
    22 <?php screen_icon(); ?>
    63 <?php screen_icon(); ?>
    23 <h2><?php echo esc_html( $title ); ?></h2>
    64 <h2><?php echo esc_html( $title ); ?></h2>
    24 
    65 
    25 <form name="form1" method="post" action="options.php">
    66 <form name="form1" method="post" action="options.php">
    26 <?php settings_fields('reading'); ?>
    67 <?php settings_fields( 'reading' ); ?>
    27 
    68 
       
    69 <?php if ( ! get_pages() ) : ?>
       
    70 <input name="show_on_front" type="hidden" value="posts" />
    28 <table class="form-table">
    71 <table class="form-table">
    29 <?php if ( get_pages() ): ?>
    72 <?php
       
    73 	if ( 'posts' != get_option( 'show_on_front' ) ) :
       
    74 		update_option( 'show_on_front', 'posts' );
       
    75 	endif;
       
    76 
       
    77 else :
       
    78 	if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
       
    79 		update_option( 'show_on_front', 'posts' );
       
    80 ?>
       
    81 <table class="form-table">
    30 <tr valign="top">
    82 <tr valign="top">
    31 <th scope="row"><?php _e('Front page displays')?></th>
    83 <th scope="row"><?php _e( 'Front page displays' ); ?></th>
    32 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Front page displays')?></span></legend>
    84 <td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Front page displays' ); ?></span></legend>
    33 	<p><label>
    85 	<p><label>
    34 		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
    86 		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
    35 		<?php _e('Your latest posts'); ?>
    87 		<?php _e( 'Your latest posts' ); ?>
    36 	</label>
    88 	</label>
    37 	</p>
    89 	</p>
    38 	<p><label>
    90 	<p><label>
    39 		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
    91 		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
    40 		<?php printf(__('A <a href="%s">static page</a> (select below)'), 'edit-pages.php'); ?>
    92 		<?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
    41 	</label>
    93 	</label>
    42 	</p>
    94 	</p>
    43 <ul>
    95 <ul>
    44 	<li><?php printf("<label for='page_on_front'>".__('Front page: %s')."</label>", wp_dropdown_pages("name=page_on_front&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_on_front'))); ?></li>
    96 	<li><label for="page_on_front"><?php printf( __( 'Front page: %s' ), wp_dropdown_pages( array( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) ) ) ); ?></label></li>
    45 	<li><?php printf("<label for='page_for_posts'>".__('Posts page: %s')."</label>", wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li>
    97 	<li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ), wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) ) ) ); ?></label></li>
    46 </ul>
    98 </ul>
    47 <?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front') ) : ?>
    99 <?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
    48 <div id="front-page-warning" class="updated fade-ff0000">
   100 <div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
    49 	<p>
       
    50 		<?php _e('<strong>Warning:</strong> these pages should not be the same!'); ?>
       
    51 	</p>
       
    52 </div>
       
    53 <?php endif; ?>
   101 <?php endif; ?>
    54 </fieldset></td>
   102 </fieldset></td>
    55 </tr>
   103 </tr>
    56 <?php endif; ?>
   104 <?php endif; ?>
    57 <tr valign="top">
   105 <tr valign="top">
    58 <th scope="row"><label for="posts_per_page"><?php _e('Blog pages show at most') ?></label></th>
   106 <th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>
    59 <td>
   107 <td>
    60 <input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" class="small-text" /> <?php _e('posts') ?>
   108 <input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option( 'posts_per_page' ); ?>" class="small-text" /> <?php _e( 'posts' ); ?>
    61 </td>
   109 </td>
    62 </tr>
   110 </tr>
    63 <tr valign="top">
   111 <tr valign="top">
    64 <th scope="row"><label for="posts_per_rss"><?php _e('Syndication feeds show the most recent') ?></label></th>
   112 <th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th>
    65 <td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" class="small-text" /> <?php _e('posts') ?></td>
   113 <td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td>
    66 </tr>
   114 </tr>
    67 <tr valign="top">
   115 <tr valign="top">
    68 <th scope="row"><?php _e('For each article in a feed, show') ?> </th>
   116 <th scope="row"><?php _e( 'For each article in a feed, show' ); ?> </th>
    69 <td><fieldset><legend class="screen-reader-text"><span><?php _e('For each article in a feed, show') ?> </span></legend>
   117 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'For each article in a feed, show' ); ?> </span></legend>
    70 <p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?>	/> <?php _e('Full text') ?></label><br />
   118 <p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?>	/> <?php _e( 'Full text' ); ?></label><br />
    71 <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
   119 <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Summary' ); ?></label></p>
    72 </fieldset></td>
   120 </fieldset></td>
    73 </tr>
   121 </tr>
    74 
   122 
    75 <tr valign="top">
   123 <tr valign="top">
    76 <th scope="row"><label for="blog_charset"><?php _e('Encoding for pages and feeds') ?></label></th>
   124 <th scope="row"><label for="blog_charset"><?php _e( 'Encoding for pages and feeds' ); ?></label></th>
    77 <td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" class="regular-text" />
   125 <td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option( 'blog_charset' ); ?>" class="regular-text" />
    78 <span class="description"><?php _e('The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your blog (UTF-8 is recommended, if you are adventurous there are some <a href="http://en.wikipedia.org/wiki/Character_set">other encodings</a>)') ?></span></td>
   126 <p class="description"><?php _e( 'The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended, if you are adventurous there are some <a href="http://en.wikipedia.org/wiki/Character_set">other encodings</a>)' ); ?></p></td>
    79 </tr>
   127 </tr>
    80 <?php do_settings_fields('reading', 'default'); ?>
   128 <?php do_settings_fields( 'reading', 'default' ); ?>
    81 </table>
   129 </table>
    82 
   130 
    83 <?php do_settings_sections('reading'); ?>
   131 <?php do_settings_sections( 'reading' ); ?>
    84 
   132 
    85 <p class="submit">
   133 <?php submit_button(); ?>
    86 	<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
       
    87 </p>
       
    88 </form>
   134 </form>
    89 </div>
   135 </div>
    90 <?php include('./admin-footer.php'); ?>
   136 <?php include( './admin-footer.php' ); ?>