WordPress.org

Make WordPress Core

Ticket #15208: 15208.2.patch

File 15208.2.patch, 2.7 KB (added by SergeyBiryukov, 4 years ago)
  • wp-admin/options-reading.php

     
    6161<form name="form1" method="post" action="options.php"> 
    6262<?php settings_fields( 'reading' ); ?> 
    6363 
    64 <?php if ( ! get_pages() ) : ?> 
    65 <input name="show_on_front" type="hidden" value="posts" /> 
    66 <table class="form-table"> 
    6764<?php 
    68         if ( 'posts' != get_option( 'show_on_front' ) ) : 
     65$published_pages_exist = get_pages(); 
     66if ( ! $published_pages_exist ) { 
     67        if ( 'posts' != get_option( 'show_on_front' ) ) 
    6968                update_option( 'show_on_front', 'posts' ); 
    70         endif; 
    71  
    72 else : 
     69} else { 
    7370        if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) 
    7471                update_option( 'show_on_front', 'posts' ); 
     72} 
    7573?> 
    7674<table class="form-table"> 
    7775<tr valign="top"> 
     
    8381        </label> 
    8482        </p> 
    8583        <p><label> 
     84        <?php if ( $published_pages_exist ) : ?>  
    8685                <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> /> 
    8786                <?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?> 
     87        <?php else : ?>  
     88                <input name="show_on_front" type="radio" value="page" class="tog" disabled="disabled" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />  
     89                <?php printf( __( 'A <a href="%s">static page</a> (you need to <strong>publish</strong> a page if you wish to use it as your site\'s front page)' ), 'edit.php?post_type=page' ); ?>  
     90        <?php endif; ?> 
    8891        </label> 
    8992        </p> 
     93<?php if ( $published_pages_exist ) : ?>  
    9094<ul> 
    9195        <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> 
    9296        <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> 
    9397</ul> 
     98<?php endif; ?> 
    9499<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?> 
    95100<div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div> 
    96101<?php endif; ?> 
    97102</fieldset></td> 
    98103</tr> 
    99 <?php endif; ?> 
    100104<tr valign="top"> 
    101105<th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th> 
    102106<td>