[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Reading settings administration panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** WordPress Administration Bootstrap */ 10 require_once __DIR__ . '/admin.php'; 11 12 if ( ! current_user_can( 'manage_options' ) ) { 13 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); 14 } 15 16 // Used in the HTML title tag. 17 $title = __( 'Reading Settings' ); 18 $parent_file = 'options-general.php'; 19 20 add_action( 'admin_head', 'options_reading_add_js' ); 21 22 get_current_screen()->add_help_tab( 23 array( 24 'id' => 'overview', 25 'title' => __( 'Overview' ), 26 'content' => '<p>' . __( 'This screen contains the settings that affect the display of your content.' ) . '</p>' . 27 '<p>' . sprintf( 28 /* translators: %s: URL to create a new page. */ 29 __( 'You can choose what’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.' ), 30 'post-new.php?post_type=page' 31 ) . '</p>' . 32 '<p>' . sprintf( 33 /* translators: %s: Documentation URL. */ 34 __( '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 an excerpt. <a href="%s">Learn more about feeds</a>.' ), 35 __( 'https://developer.wordpress.org/advanced-administration/wordpress/feeds/' ) 36 ) . '</p>' . 37 '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>', 38 ) 39 ); 40 41 get_current_screen()->add_help_tab( 42 array( 43 'id' => 'site-visibility', 44 'title' => has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ), 45 '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 “Discourage search engines from indexing this site” and click the Save Changes button at the bottom of the screen.' ) . '</p>' . 46 '<p>' . __( 'Note that even when set to discourage search engines, your site is still visible on the web and not all search engines adhere to this directive.' ) . '</p>' . 47 '<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, “Search engines discouraged”, to remind you that you have directed search engines to not crawl your site.' ) . '</p>', 48 ) 49 ); 50 51 get_current_screen()->set_help_sidebar( 52 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 53 '<p>' . __( '<a href="https://wordpress.org/documentation/article/settings-reading-screen/">Documentation on Reading Settings</a>' ) . '</p>' . 54 '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' 55 ); 56 57 require_once ABSPATH . 'wp-admin/admin-header.php'; 58 ?> 59 60 <div class="wrap"> 61 <h1><?php echo esc_html( $title ); ?></h1> 62 63 <form method="post" action="options.php"> 64 <?php 65 settings_fields( 'reading' ); 66 67 if ( ! is_utf8_charset() ) { 68 add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) ); 69 } 70 ?> 71 72 <?php if ( ! get_pages() ) : ?> 73 <input name="show_on_front" type="hidden" value="posts" /> 74 <table class="form-table" role="presentation"> 75 <?php 76 if ( 'posts' !== get_option( 'show_on_front' ) ) : 77 update_option( 'show_on_front', 'posts' ); 78 endif; 79 80 else : 81 if ( 'page' === get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) { 82 update_option( 'show_on_front', 'posts' ); 83 } 84 85 $your_homepage_displays_title = __( 'Your homepage displays' ); 86 ?> 87 <table class="form-table" role="presentation"> 88 <tr> 89 <th scope="row"><?php echo $your_homepage_displays_title; ?></th> 90 <td id="front-static-pages"><fieldset> 91 <legend class="screen-reader-text"><span><?php echo $your_homepage_displays_title; ?></span></legend> 92 <p><label> 93 <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> /> 94 <?php _e( 'Your latest posts' ); ?> 95 </label> 96 </p> 97 <p><label> 98 <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> /> 99 <?php 100 printf( 101 /* translators: %s: URL to Pages screen. */ 102 __( 'A <a href="%s">static page</a> (select below)' ), 103 'edit.php?post_type=page' 104 ); 105 ?> 106 </label> 107 </p> 108 <ul> 109 <li><label for="page_on_front"> 110 <?php 111 printf( 112 /* translators: %s: Select field to choose the front page. */ 113 __( 'Homepage: %s' ), 114 wp_dropdown_pages( 115 array( 116 'name' => 'page_on_front', 117 'echo' => 0, 118 'show_option_none' => __( '— Select —' ), 119 'option_none_value' => '0', 120 'selected' => get_option( 'page_on_front' ), 121 ) 122 ) 123 ); 124 ?> 125 </label></li> 126 <li><label for="page_for_posts"> 127 <?php 128 printf( 129 /* translators: %s: Select field to choose the page for posts. */ 130 __( 'Posts page: %s' ), 131 wp_dropdown_pages( 132 array( 133 'name' => 'page_for_posts', 134 'echo' => 0, 135 'show_option_none' => __( '— Select —' ), 136 'option_none_value' => '0', 137 'selected' => get_option( 'page_for_posts' ), 138 ) 139 ) 140 ); 141 ?> 142 </label></li> 143 </ul> 144 <?php 145 if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) === get_option( 'page_on_front' ) ) : 146 wp_admin_notice( 147 __( '<strong>Warning:</strong> these pages should not be the same!' ), 148 array( 149 'type' => 'warning', 150 'id' => 'front-page-warning', 151 'additional_classes' => array( 'inline' ), 152 ) 153 ); 154 endif; 155 if ( get_option( 'wp_page_for_privacy_policy' ) === get_option( 'page_for_posts' ) || get_option( 'wp_page_for_privacy_policy' ) === get_option( 'page_on_front' ) ) : 156 wp_admin_notice( 157 __( '<strong>Warning:</strong> these pages should not be the same as your Privacy Policy page!' ), 158 array( 159 'type' => 'warning', 160 'id' => 'privacy-policy-page-warning', 161 'additional_classes' => array( 'inline' ), 162 ) 163 ); 164 endif; 165 ?> 166 </fieldset></td> 167 </tr> 168 <?php endif; ?> 169 <tr> 170 <th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th> 171 <td> 172 <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' ); ?> 173 </td> 174 </tr> 175 <tr> 176 <th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th> 177 <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> 178 </tr> 179 180 <?php $rss_use_excerpt_title = __( 'For each post in a feed, include' ); ?> 181 <tr> 182 <th scope="row"><?php echo $rss_use_excerpt_title; ?> </th> 183 <td><fieldset> 184 <legend class="screen-reader-text"><span><?php echo $rss_use_excerpt_title; ?></span></legend> 185 <p> 186 <label><input name="rss_use_excerpt" type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Full text' ); ?></label><br /> 187 <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Excerpt' ); ?></label> 188 </p> 189 <p class="description"> 190 <?php 191 printf( 192 /* translators: %s: Documentation URL. */ 193 __( 'Your theme determines how content is displayed in browsers. <a href="%s">Learn more about feeds</a>.' ), 194 __( 'https://developer.wordpress.org/advanced-administration/wordpress/feeds/' ) 195 ); 196 ?> 197 </p> 198 </fieldset></td> 199 </tr> 200 201 <?php $blog_privacy_selector_title = has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ); ?> 202 <tr class="option-site-visibility"> 203 <th scope="row"><?php echo $blog_privacy_selector_title; ?> </th> 204 <td><fieldset> 205 <legend class="screen-reader-text"><span><?php echo $blog_privacy_selector_title; ?></span></legend> 206 <?php if ( has_action( 'blog_privacy_selector' ) ) : ?> 207 <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( '1', get_option( 'blog_public' ) ); ?> /> 208 <label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br /> 209 <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> /> 210 <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> 211 <p class="description"><?php _e( 'Note: Neither of these options blocks access to your site — it is up to search engines to honor your request.' ); ?></p> 212 <?php 213 /** 214 * Enables the legacy 'Site visibility' privacy options. 215 * 216 * By default the privacy options form displays a single checkbox to 'discourage' search 217 * engines from indexing the site. Hooking to this action serves a dual purpose: 218 * 219 * 1. Disable the single checkbox in favor of a multiple-choice list of radio buttons. 220 * 2. Open the door to adding additional radio button choices to the list. 221 * 222 * Hooking to this action also converts the 'Search engine visibility' heading to the more 223 * open-ended 'Site visibility' heading. 224 * 225 * @since 2.1.0 226 */ 227 do_action( 'blog_privacy_selector' ); 228 ?> 229 <?php else : ?> 230 <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> /> 231 <?php _e( 'Discourage search engines from indexing this site' ); ?></label> 232 <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> 233 <?php endif; ?> 234 </fieldset></td> 235 </tr> 236 237 <?php do_settings_fields( 'reading', 'default' ); ?> 238 </table> 239 240 <?php do_settings_sections( 'reading' ); ?> 241 242 <?php submit_button(); ?> 243 </form> 244 </div> 245 <?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Fri Oct 10 08:20:03 2025 | Cross-referenced by PHPXref |