wp/wp-admin/options-reading.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
     7  */
     7  */
     8 
     8 
     9 /** WordPress Administration Bootstrap */
     9 /** WordPress Administration Bootstrap */
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    11 
    11 
    12 if ( ! current_user_can( 'manage_options' ) )
    12 if ( ! current_user_can( 'manage_options' ) ) {
    13 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
    13 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
       
    14 }
    14 
    15 
    15 $title = __( 'Reading Settings' );
    16 $title       = __( 'Reading Settings' );
    16 $parent_file = 'options-general.php';
    17 $parent_file = 'options-general.php';
    17 
    18 
    18 add_action('admin_head', 'options_reading_add_js');
    19 add_action( 'admin_head', 'options_reading_add_js' );
    19 
    20 
    20 get_current_screen()->add_help_tab( array(
    21 get_current_screen()->add_help_tab(
    21 	'id'      => 'overview',
    22 	array(
    22 	'title'   => __('Overview'),
    23 		'id'      => 'overview',
    23 	'content' => '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
    24 		'title'   => __( 'Overview' ),
    24 		'<p>' . sprintf(__('You can choose what&#8217;s displayed on the homepage of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static homepage, you first need to create two <a href="%s">Pages</a>. One will become the homepage, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' .
    25 		'content' => '<p>' . __( 'This screen contains the settings that affect the display of your content.' ) . '</p>' .
    25 		'<p>' . __('You can also control the display of your content in RSS feeds, including the maximum number of posts to display and whether to show full text or a summary.') . '</p>' .
    26 			'<p>' . sprintf( __( 'You can choose what&#8217;s displayed on the homepage of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static homepage, you first need to create two <a href="%s">Pages</a>. One will become the homepage, and the other will be where your posts are displayed.' ), 'post-new.php?post_type=page' ) . '</p>' .
    26 		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
    27 			'<p>' . __( 'You can also control the display of your content in RSS feeds, including the maximum number of posts to display and whether to show full text or a summary.' ) . '</p>' .
    27 ) );
    28 			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
       
    29 	)
       
    30 );
    28 
    31 
    29 get_current_screen()->add_help_tab( array(
    32 get_current_screen()->add_help_tab(
    30 	'id'      => 'site-visibility',
    33 	array(
    31 	'title'   => has_action( 'blog_privacy_selector' ) ? __( 'Site Visibility' ) : __( 'Search Engine Visibility' ),
    34 		'id'      => 'site-visibility',
    32 	'content' => '<p>' . __( 'You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.' ) . '</p>' .
    35 		'title'   => has_action( 'blog_privacy_selector' ) ? __( 'Site Visibility' ) : __( 'Search Engine Visibility' ),
    33 		'<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, &#8220;Search Engines Discouraged,&#8221; to remind you that your site is not being crawled.' ) . '</p>',
    36 		'content' => '<p>' . __( 'You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.' ) . '</p>' .
    34 ) );
    37 			'<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, &#8220;Search Engines Discouraged,&#8221; to remind you that your site is not being crawled.' ) . '</p>',
       
    38 	)
       
    39 );
    35 
    40 
    36 get_current_screen()->set_help_sidebar(
    41 get_current_screen()->set_help_sidebar(
    37 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    42 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    38 	'<p>' . __('<a href="https://codex.wordpress.org/Settings_Reading_Screen">Documentation on Reading Settings</a>') . '</p>' .
    43 	'<p>' . __( '<a href="https://codex.wordpress.org/Settings_Reading_Screen">Documentation on Reading Settings</a>' ) . '</p>' .
    39 	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
    44 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    40 );
    45 );
    41 
    46 
    42 include( ABSPATH . 'wp-admin/admin-header.php' );
    47 include( ABSPATH . 'wp-admin/admin-header.php' );
    43 ?>
    48 ?>
    44 
    49 
    47 
    52 
    48 <form method="post" action="options.php">
    53 <form method="post" action="options.php">
    49 <?php
    54 <?php
    50 settings_fields( 'reading' );
    55 settings_fields( 'reading' );
    51 
    56 
    52 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
    57 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
    53 	add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
    58 	add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
       
    59 }
    54 ?>
    60 ?>
    55 
    61 
    56 <?php if ( ! get_pages() ) : ?>
    62 <?php if ( ! get_pages() ) : ?>
    57 <input name="show_on_front" type="hidden" value="posts" />
    63 <input name="show_on_front" type="hidden" value="posts" />
    58 <table class="form-table">
    64 <table class="form-table" role="presentation">
    59 <?php
    65 	<?php
    60 	if ( 'posts' != get_option( 'show_on_front' ) ) :
    66 	if ( 'posts' != get_option( 'show_on_front' ) ) :
    61 		update_option( 'show_on_front', 'posts' );
    67 		update_option( 'show_on_front', 'posts' );
    62 	endif;
    68 	endif;
    63 
    69 
    64 else :
    70 else :
    65 	if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
    71 	if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) {
    66 		update_option( 'show_on_front', 'posts' );
    72 		update_option( 'show_on_front', 'posts' );
    67 ?>
    73 	}
    68 <table class="form-table">
    74 	?>
       
    75 <table class="form-table" role="presentation">
    69 <tr>
    76 <tr>
    70 <th scope="row"><?php _e( 'Your homepage displays' ); ?></th>
    77 <th scope="row"><?php _e( 'Your homepage displays' ); ?></th>
    71 <td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Your homepage displays' ); ?></span></legend>
    78 <td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Your homepage displays' ); ?></span></legend>
    72 	<p><label>
    79 	<p><label>
    73 		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
    80 		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
    78 		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
    85 		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
    79 		<?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
    86 		<?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
    80 	</label>
    87 	</label>
    81 	</p>
    88 	</p>
    82 <ul>
    89 <ul>
    83 	<li><label for="page_on_front"><?php printf( __( 'Homepage: %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>
    90 	<li><label for="page_on_front">
    84 	<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>
    91 	<?php
       
    92 	printf(
       
    93 		__( 'Homepage: %s' ),
       
    94 		wp_dropdown_pages(
       
    95 			array(
       
    96 				'name'              => 'page_on_front',
       
    97 				'echo'              => 0,
       
    98 				'show_option_none'  => __( '&mdash; Select &mdash;' ),
       
    99 				'option_none_value' => '0',
       
   100 				'selected'          => get_option( 'page_on_front' ),
       
   101 			)
       
   102 		)
       
   103 	);
       
   104 	?>
       
   105 </label></li>
       
   106 	<li><label for="page_for_posts">
       
   107 	<?php
       
   108 	printf(
       
   109 		__( 'Posts page: %s' ),
       
   110 		wp_dropdown_pages(
       
   111 			array(
       
   112 				'name'              => 'page_for_posts',
       
   113 				'echo'              => 0,
       
   114 				'show_option_none'  => __( '&mdash; Select &mdash;' ),
       
   115 				'option_none_value' => '0',
       
   116 				'selected'          => get_option( 'page_for_posts' ),
       
   117 			)
       
   118 		)
       
   119 	);
       
   120 	?>
       
   121 </label></li>
    85 </ul>
   122 </ul>
    86 <?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
   123 	<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
    87 <div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
   124 <div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
    88 <?php endif; ?>
   125 <?php endif; ?>
    89 </fieldset></td>
   126 </fieldset></td>
    90 </tr>
   127 </tr>
    91 <?php endif; ?>
   128 <?php endif; ?>
   109 
   146 
   110 <tr class="option-site-visibility">
   147 <tr class="option-site-visibility">
   111 <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </th>
   148 <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </th>
   112 <td><fieldset><legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
   149 <td><fieldset><legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
   113 <?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
   150 <?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
   114 	<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
   151 	<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( '1', get_option( 'blog_public' ) ); ?> />
   115 	<label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/>
   152 	<label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br/>
   116 	<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
   153 	<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
   117 	<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
   154 	<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
   118 	<p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
   155 	<p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
   119 	<?php
   156 	<?php
   120 	/**
   157 	/**
   121 	 * Enable the legacy 'Site Visibility' privacy options.
   158 	 * Enable the legacy 'Site Visibility' privacy options.