author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:40:08 +0200 | |
changeset 21 | 48c4eec2b7e6 |
parent 19 | 3d72ae0968f4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Reading settings administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** WordPress Administration Bootstrap */ |
|
16 | 10 |
require_once __DIR__ . '/admin.php'; |
0 | 11 |
|
9 | 12 |
if ( ! current_user_can( 'manage_options' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
9 | 14 |
} |
0 | 15 |
|
19 | 16 |
// Used in the HTML title tag. |
9 | 17 |
$title = __( 'Reading Settings' ); |
0 | 18 |
$parent_file = 'options-general.php'; |
19 |
||
9 | 20 |
add_action( 'admin_head', 'options_reading_add_js' ); |
0 | 21 |
|
9 | 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>' . |
|
16 | 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. */ |
|
18 | 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>.' ), |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
35 |
__( 'https://developer.wordpress.org/advanced-administration/wordpress/feeds/' ) |
16 | 36 |
) . '</p>' . |
9 | 37 |
'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>', |
38 |
) |
|
39 |
); |
|
0 | 40 |
|
9 | 41 |
get_current_screen()->add_help_tab( |
42 |
array( |
|
43 |
'id' => 'site-visibility', |
|
16 | 44 |
'title' => has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ), |
18 | 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>', |
|
9 | 48 |
) |
49 |
); |
|
0 | 50 |
|
51 |
get_current_screen()->set_help_sidebar( |
|
9 | 52 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
53 |
'<p>' . __( '<a href="https://wordpress.org/documentation/article/settings-reading-screen/">Documentation on Reading Settings</a>' ) . '</p>' . |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
54 |
'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' |
0 | 55 |
); |
56 |
||
16 | 57 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
0 | 58 |
?> |
59 |
||
60 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
<h1><?php echo esc_html( $title ); ?></h1> |
0 | 62 |
|
63 |
<form method="post" action="options.php"> |
|
64 |
<?php |
|
65 |
settings_fields( 'reading' ); |
|
66 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
67 |
if ( ! is_utf8_charset() ) { |
0 | 68 |
add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) ); |
9 | 69 |
} |
0 | 70 |
?> |
71 |
||
72 |
<?php if ( ! get_pages() ) : ?> |
|
73 |
<input name="show_on_front" type="hidden" value="posts" /> |
|
9 | 74 |
<table class="form-table" role="presentation"> |
75 |
<?php |
|
19 | 76 |
if ( 'posts' !== get_option( 'show_on_front' ) ) : |
0 | 77 |
update_option( 'show_on_front', 'posts' ); |
78 |
endif; |
|
79 |
||
80 |
else : |
|
16 | 81 |
if ( 'page' === get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) { |
0 | 82 |
update_option( 'show_on_front', 'posts' ); |
9 | 83 |
} |
84 |
?> |
|
85 |
<table class="form-table" role="presentation"> |
|
5 | 86 |
<tr> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
<th scope="row"><?php _e( 'Your homepage displays' ); ?></th> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
88 |
<td id="front-static-pages"><fieldset> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
89 |
<legend class="screen-reader-text"><span> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
90 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
91 |
/* translators: Hidden accessibility text. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
92 |
_e( 'Your homepage displays' ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
93 |
?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
94 |
</span></legend> |
0 | 95 |
<p><label> |
96 |
<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> /> |
|
97 |
<?php _e( 'Your latest posts' ); ?> |
|
98 |
</label> |
|
99 |
</p> |
|
100 |
<p><label> |
|
101 |
<input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> /> |
|
16 | 102 |
<?php |
103 |
printf( |
|
104 |
/* translators: %s: URL to Pages screen. */ |
|
105 |
__( 'A <a href="%s">static page</a> (select below)' ), |
|
106 |
'edit.php?post_type=page' |
|
107 |
); |
|
108 |
?> |
|
0 | 109 |
</label> |
110 |
</p> |
|
111 |
<ul> |
|
9 | 112 |
<li><label for="page_on_front"> |
113 |
<?php |
|
114 |
printf( |
|
16 | 115 |
/* translators: %s: Select field to choose the front page. */ |
9 | 116 |
__( 'Homepage: %s' ), |
117 |
wp_dropdown_pages( |
|
118 |
array( |
|
119 |
'name' => 'page_on_front', |
|
120 |
'echo' => 0, |
|
121 |
'show_option_none' => __( '— Select —' ), |
|
122 |
'option_none_value' => '0', |
|
123 |
'selected' => get_option( 'page_on_front' ), |
|
124 |
) |
|
125 |
) |
|
126 |
); |
|
127 |
?> |
|
128 |
</label></li> |
|
129 |
<li><label for="page_for_posts"> |
|
130 |
<?php |
|
131 |
printf( |
|
16 | 132 |
/* translators: %s: Select field to choose the page for posts. */ |
9 | 133 |
__( 'Posts page: %s' ), |
134 |
wp_dropdown_pages( |
|
135 |
array( |
|
136 |
'name' => 'page_for_posts', |
|
137 |
'echo' => 0, |
|
138 |
'show_option_none' => __( '— Select —' ), |
|
139 |
'option_none_value' => '0', |
|
140 |
'selected' => get_option( 'page_for_posts' ), |
|
141 |
) |
|
142 |
) |
|
143 |
); |
|
144 |
?> |
|
145 |
</label></li> |
|
0 | 146 |
</ul> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
147 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
148 |
if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) === get_option( 'page_on_front' ) ) : |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
149 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
150 |
__( '<strong>Warning:</strong> these pages should not be the same!' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
151 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
152 |
'type' => 'warning', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
153 |
'id' => 'front-page-warning', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
154 |
'additional_classes' => array( 'inline' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
155 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
156 |
); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
157 |
endif; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
158 |
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' ) ) : |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
159 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
160 |
__( '<strong>Warning:</strong> these pages should not be the same as your Privacy Policy page!' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
161 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
162 |
'type' => 'warning', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
163 |
'id' => 'privacy-policy-page-warning', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
164 |
'additional_classes' => array( 'inline' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
165 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
166 |
); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
167 |
endif; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
168 |
?> |
0 | 169 |
</fieldset></td> |
170 |
</tr> |
|
171 |
<?php endif; ?> |
|
5 | 172 |
<tr> |
0 | 173 |
<th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th> |
174 |
<td> |
|
175 |
<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' ); ?> |
|
176 |
</td> |
|
177 |
</tr> |
|
5 | 178 |
<tr> |
0 | 179 |
<th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th> |
180 |
<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> |
|
181 |
</tr> |
|
5 | 182 |
<tr> |
16 | 183 |
<th scope="row"><?php _e( 'For each post in a feed, include' ); ?> </th> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
184 |
<td><fieldset> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
185 |
<legend class="screen-reader-text"><span> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
186 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
187 |
/* translators: Hidden accessibility text. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
188 |
_e( 'For each post in a feed, include' ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
189 |
?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
190 |
</span></legend> |
16 | 191 |
<p> |
192 |
<label><input name="rss_use_excerpt" type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Full text' ); ?></label><br /> |
|
18 | 193 |
<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Excerpt' ); ?></label> |
16 | 194 |
</p> |
195 |
<p class="description"> |
|
196 |
<?php |
|
197 |
printf( |
|
198 |
/* translators: %s: Documentation URL. */ |
|
199 |
__( 'Your theme determines how content is displayed in browsers. <a href="%s">Learn more about feeds</a>.' ), |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
200 |
__( 'https://developer.wordpress.org/advanced-administration/wordpress/feeds/' ) |
16 | 201 |
); |
202 |
?> |
|
203 |
</p> |
|
0 | 204 |
</fieldset></td> |
205 |
</tr> |
|
206 |
||
5 | 207 |
<tr class="option-site-visibility"> |
16 | 208 |
<th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?> </th> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
209 |
<td><fieldset> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
210 |
<legend class="screen-reader-text"><span> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
211 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
212 |
has_action( 'blog_privacy_selector' ) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
213 |
/* translators: Hidden accessibility text. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
214 |
? _e( 'Site visibility' ) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
215 |
/* translators: Hidden accessibility text. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
216 |
: _e( 'Search engine visibility' ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
217 |
?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
218 |
</span></legend> |
0 | 219 |
<?php if ( has_action( 'blog_privacy_selector' ) ) : ?> |
9 | 220 |
<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( '1', get_option( 'blog_public' ) ); ?> /> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
221 |
<label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br /> |
9 | 222 |
<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> /> |
0 | 223 |
<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
224 |
<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> |
|
225 |
<?php |
|
226 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
227 |
* Enables the legacy 'Site visibility' privacy options. |
0 | 228 |
* |
229 |
* By default the privacy options form displays a single checkbox to 'discourage' search |
|
230 |
* engines from indexing the site. Hooking to this action serves a dual purpose: |
|
19 | 231 |
* |
0 | 232 |
* 1. Disable the single checkbox in favor of a multiple-choice list of radio buttons. |
233 |
* 2. Open the door to adding additional radio button choices to the list. |
|
234 |
* |
|
16 | 235 |
* Hooking to this action also converts the 'Search engine visibility' heading to the more |
236 |
* open-ended 'Site visibility' heading. |
|
0 | 237 |
* |
238 |
* @since 2.1.0 |
|
239 |
*/ |
|
240 |
do_action( 'blog_privacy_selector' ); |
|
241 |
?> |
|
242 |
<?php else : ?> |
|
243 |
<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> /> |
|
244 |
<?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
|
245 |
<p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> |
|
246 |
<?php endif; ?> |
|
247 |
</fieldset></td> |
|
248 |
</tr> |
|
249 |
||
250 |
<?php do_settings_fields( 'reading', 'default' ); ?> |
|
251 |
</table> |
|
252 |
||
253 |
<?php do_settings_sections( 'reading' ); ?> |
|
254 |
||
255 |
<?php submit_button(); ?> |
|
256 |
</form> |
|
257 |
</div> |
|
16 | 258 |
<?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?> |