Created
July 24, 2020 22:54
-
-
Save cornelRaiu/0e7dcf84e4830654f87af2c4ad9d8f84 to your computer and use it in GitHub Desktop.
Reading Settings page - Your homepage displays section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if ( ! get_pages() ) : ?> | |
| <input name="show_on_front" type="hidden" value="posts" /> | |
| <table class="form-table" role="presentation"> | |
| <?php | |
| if ( 'posts' != get_option( 'show_on_front' ) ) : | |
| update_option( 'show_on_front', 'posts' ); | |
| endif; | |
| else : | |
| if ( 'page' === get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) { | |
| update_option( 'show_on_front', 'posts' ); | |
| } | |
| ?> | |
| <table class="form-table" role="presentation"> | |
| <tr> | |
| <th scope="row"><?php _e( 'Your homepage displays' ); ?></th> | |
| <td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Your homepage displays' ); ?></span></legend> | |
| <p><label> | |
| <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> /> | |
| <?php _e( 'Your latest posts' ); ?> | |
| </label> | |
| </p> | |
| <p><label> | |
| <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> /> | |
| <?php | |
| printf( | |
| /* translators: %s: URL to Pages screen. */ | |
| __( 'A <a href="%s">static page</a> (select below)' ), | |
| 'edit.php?post_type=page' | |
| ); | |
| ?> | |
| </label> | |
| </p> | |
| <ul> | |
| <li><label for="page_on_front"> | |
| <?php | |
| printf( | |
| /* translators: %s: Select field to choose the front page. */ | |
| __( 'Homepage: %s' ), | |
| wp_dropdown_pages( | |
| array( | |
| 'name' => 'page_on_front', | |
| 'echo' => 0, | |
| 'show_option_none' => __( '— Select —' ), | |
| 'option_none_value' => '0', | |
| 'selected' => get_option( 'page_on_front' ), | |
| ) | |
| ) | |
| ); | |
| ?> | |
| </label></li> | |
| <li><label for="page_for_posts"> | |
| <?php | |
| printf( | |
| /* translators: %s: Select field to choose the page for posts. */ | |
| __( 'Posts page: %s' ), | |
| wp_dropdown_pages( | |
| array( | |
| 'name' => 'page_for_posts', | |
| 'echo' => 0, | |
| 'show_option_none' => __( '— Select —' ), | |
| 'option_none_value' => '0', | |
| 'selected' => get_option( 'page_for_posts' ), | |
| ) | |
| ) | |
| ); | |
| ?> | |
| </label></li> | |
| </ul> | |
| <?php if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) === get_option( 'page_on_front' ) ) : ?> | |
| <div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div> | |
| <?php endif; ?> | |
| <?php 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' ) ) : ?> | |
| <div id="privacy-policy-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same as your Privacy Policy page!' ); ?></p></div> | |
| <?php endif; ?> | |
| </fieldset></td> | |
| </tr> | |
| <?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment