options-reading.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /**
  3. * Reading settings administration panel.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. /** WordPress Administration Bootstrap */
  9. require_once( './admin.php' );
  10. if ( ! current_user_can( 'manage_options' ) )
  11. wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
  12. $title = __( 'Reading Settings' );
  13. $parent_file = 'options-general.php';
  14. /**
  15. * Display JavaScript on the page.
  16. *
  17. * @package WordPress
  18. * @subpackage Reading_Settings_Screen
  19. */
  20. function add_js() {
  21. ?>
  22. <script type="text/javascript">
  23. //<![CDATA[
  24. jQuery(document).ready(function($){
  25. var section = $('#front-static-pages'),
  26. staticPage = section.find('input:radio[value="page"]'),
  27. selects = section.find('select'),
  28. check_disabled = function(){
  29. selects.prop( 'disabled', ! staticPage.prop('checked') );
  30. };
  31. check_disabled();
  32. section.find('input:radio').change(check_disabled);
  33. });
  34. //]]>
  35. </script>
  36. <?php
  37. }
  38. add_action('admin_head', 'add_js');
  39. add_contextual_help($current_screen,
  40. '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
  41. '<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>' .
  42. '<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>' .
  43. '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>' .
  44. '<p><strong>' . __('For more information:') . '</strong></p>' .
  45. '<p>' . __('<a href="http://codex.wordpress.org/Settings_Reading_Screen" target="_blank">Documentation on Reading Settings</a>') . '</p>' .
  46. '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
  47. );
  48. include( './admin-header.php' );
  49. ?>
  50. <div class="wrap">
  51. <?php screen_icon(); ?>
  52. <h2><?php echo esc_html( $title ); ?></h2>
  53. <form name="form1" method="post" action="options.php">
  54. <?php settings_fields( 'reading' ); ?>
  55. <?php if ( ! get_pages() ) : ?>
  56. <input name="show_on_front" type="hidden" value="posts" />
  57. <table class="form-table">
  58. <?php
  59. if ( 'posts' != get_option( 'show_on_front' ) ) :
  60. update_option( 'show_on_front', 'posts' );
  61. endif;
  62. else :
  63. if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
  64. update_option( 'show_on_front', 'posts' );
  65. ?>
  66. <table class="form-table">
  67. <tr valign="top">
  68. <th scope="row"><?php _e( 'Front page displays' ); ?></th>
  69. <td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Front page displays' ); ?></span></legend>
  70. <p><label>
  71. <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
  72. <?php _e( 'Your latest posts' ); ?>
  73. </label>
  74. </p>
  75. <p><label>
  76. <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
  77. <?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
  78. </label>
  79. </p>
  80. <ul>
  81. <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>
  82. <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>
  83. </ul>
  84. <?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
  85. <div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
  86. <?php endif; ?>
  87. </fieldset></td>
  88. </tr>
  89. <?php endif; ?>
  90. <tr valign="top">
  91. <th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>
  92. <td>
  93. <input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option( 'posts_per_page' ); ?>" class="small-text" /> <?php _e( 'posts' ); ?>
  94. </td>
  95. </tr>
  96. <tr valign="top">
  97. <th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th>
  98. <td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td>
  99. </tr>
  100. <tr valign="top">
  101. <th scope="row"><?php _e( 'For each article in a feed, show' ); ?> </th>
  102. <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'For each article in a feed, show' ); ?> </span></legend>
  103. <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 />
  104. <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Summary' ); ?></label></p>
  105. </fieldset></td>
  106. </tr>
  107. <tr valign="top">
  108. <th scope="row"><label for="blog_charset"><?php _e( 'Encoding for pages and feeds' ); ?></label></th>
  109. <td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option( 'blog_charset' ); ?>" class="regular-text" />
  110. <span 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>)' ); ?></span></td>
  111. </tr>
  112. <?php do_settings_fields( 'reading', 'default' ); ?>
  113. </table>
  114. <?php do_settings_sections( 'reading' ); ?>
  115. <?php submit_button(); ?>
  116. </form>
  117. </div>
  118. <?php include( './admin-footer.php' ); ?>