Browse files

Output a hidden input of blog_charset when we are hiding the option. …

…props SergeyBiryukov. see #21507.

git-svn-id: http://core.svn.wordpress.org/trunk@21539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 65f5267 commit c1816c4bfe023e8a5d9f6baa4bcb0345f0514bd8 @nacin nacin committed Aug 17, 2012
Showing with 14 additions and 12 deletions.
  1. +14 −12 wp-admin/options-reading.php
View
26 wp-admin/options-reading.php
@@ -64,7 +64,19 @@ function add_js() {
<h2><?php echo esc_html( $title ); ?></h2>
<form name="form1" method="post" action="options.php">
-<?php settings_fields( 'reading' ); ?>
+<?php
+settings_fields( 'reading' );
+
+function options_reading_blog_charset() {
+ echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
+ echo '<p class="description">' . __( 'The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>';
+}
+
+if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
+ add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading' );
+else
+ echo '<input name="blog_charset" type="hidden" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" />';
+?>
<?php if ( ! get_pages() ) : ?>
<input name="show_on_front" type="hidden" value="posts" />
@@ -120,17 +132,7 @@ function add_js() {
</fieldset></td>
</tr>
-<?php
-function options_reading_blog_charset() {
- echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
- echo '<p class="description">' . __( 'The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)' )
- . '</p>';
-}
-
-if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
- add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading' );
-
-do_settings_fields( 'reading', 'default' ); ?>
+<?php do_settings_fields( 'reading', 'default' ); ?>
</table>
<?php do_settings_sections( 'reading' ); ?>

0 comments on commit c1816c4

Please sign in to comment.