Ticket #16379: 16379.10.patch
File 16379.10.patch, 23.7 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/post.php
1330 1330 } 1331 1331 1332 1332 /** 1333 * Checks if page on front is set, else shows latests posts 1334 * 1335 * @since 3.5.0 1336 * @access private 1337 */ 1338 1339 function _show_on_front_cant_create_pages () { 1340 1341 // If an existing page is set, keep things as is, rather than reverting to showing posts. 1342 if ( get_option( 'page_on_front' ) ) { 1343 $show_on_front_value = 'page'; 1344 } else { 1345 $show_on_front_value = 'posts'; 1346 update_option( 'page_on_front', 0 ); 1347 update_option( 'page_for_posts', 0 ); 1348 } 1349 add_settings_error( 'page_on_front', 'create_pages', __( 'You are not allowed to create pages on this site.' ) ); 1350 return $show_on_front_value; 1351 } 1352 1353 /** 1333 1354 * Creates new pages to be set as a front page or a page for posts in Reading Settings. 1334 1355 * 1335 1356 * @todo Make sure we are doing adequate sanitization on success, and cleanup/reset on failure. … … 1338 1359 * @access private 1339 1360 */ 1340 1361 function _show_on_front_reading_settings( $show_on_front_value ) { 1362 1341 1363 // If we're not saving the Reading Settings screen, don't intercept. 1342 1364 if ( ! $_POST || ! strpos( wp_get_referer(), 'options-reading.php' ) ) 1343 1365 return $show_on_front_value; 1344 1366 1367 // If 'latest posts' is set, stop here 1345 1368 if ( 'posts' == $show_on_front_value ) { 1346 1369 update_option( 'page_on_front', 0 ); 1347 1370 update_option( 'page_for_posts', 0 ); 1371 1348 1372 return $show_on_front_value; 1349 1373 } 1374 1375 // They didn't select a page at all. Sad face. 1376 if ( ! $_POST['page_on_front_title'] ) { 1377 $show_on_front_value = 'posts'; 1378 update_option( 'page_on_front', 0 ); 1379 update_option( 'page_for_posts', 0 ); 1380 add_settings_error( 'page_on_front', 'no_page_selected', __( 'You must select a page to set a static front page.' ) ); 1381 return $show_on_front_value; 1382 } 1383 1384 // PAGE_ON_FRONT 1385 $existing_page_on_front = get_page_by_title( stripslashes( $_POST['page_on_front_title'] ) ); 1350 1386 1351 // If a new front page was meant to be created, go forth and create it. 1352 if ( 'new' == $_POST['page_on_front'] ) { 1353 1387 if ( $existing_page_on_front && $existing_page_on_front->ID && 'publish' == $existing_page_on_front->post_status && 'page' == $existing_page_on_front->post_type ) { 1388 1389 // If a page exists with this same title, use it 1390 update_option( 'page_on_front', (int) $existing_page_on_front->ID ); 1391 } else { 1392 1354 1393 // If the user can't create pages, revert. 1355 1394 if ( ! current_user_can( 'create_posts', 'page' ) ) { 1356 // If an existing page is set, keep things as is, rather than reverting to showing posts. 1357 if ( get_option( 'page_on_front' ) ) { 1358 $show_on_front_value = 'page'; 1359 } else { 1360 $show_on_front_value = 'posts'; 1361 update_option( 'page_on_front', 0 ); 1362 update_option( 'page_for_posts', 0 ); 1363 } 1364 add_settings_error( 'page_on_front', 'create_pages', __( 'You are not allowed to create pages on this site.' ) ); 1365 return $show_on_front_value; 1395 return _show_on_front_cant_create_pages(); 1366 1396 } 1367 1368 $existing_page = get_page_by_title( stripslashes( $_POST['page_on_front_title'] ) ); 1369 1370 // If page already exists and it's public, there's no need to create a new page. 1371 if ( $existing_page && 'publish' == $existing_page->post_status ) { 1372 $page_id = $existing_page->ID; 1373 } else { 1374 $page_id = wp_insert_post( array( 1375 'post_title' => $_POST['page_on_front_title'], 1376 'post_type' => 'page', 1377 'post_status' => 'publish', 1378 'comment_status' => 'closed', 1379 'ping_status' => 'closed', 1380 // @todo Create some sort of a 'context' in postmeta so we know we created a page through these means. 1381 // Consider then showing that context in the list table as a good-first-step. 1382 ) ); 1383 } 1384 1397 1398 // Create new page 1399 $page_id = wp_insert_post( array( 1400 'post_title' => wp_strip_all_tags( $_POST['page_on_front_title'] ), 1401 'post_type' => 'page', 1402 'post_status' => 'publish', 1403 'comment_status' => 'closed', 1404 'ping_status' => 'closed' 1405 // @todo Create some sort of a 'context' in postmeta so we know we created a page through these means. 1406 // Consider then showing that context in the list table as a good-first-step. 1407 ) ); 1408 1385 1409 if ( $page_id ) { 1386 1410 update_option( 'page_on_front', $page_id ); 1387 // If we can't save it, revert.1388 } elseif ( get_option( 'page_on_front' ) ) {1389 // If an existing page is set, keep things as is, rather than reverting to showing posts.1390 $show_on_front_value = 'page';1391 1411 } else { 1392 $show_on_front_value = 'posts'; 1393 update_option( 'page_on_front', 0 ); 1394 update_option( 'page_for_posts', 0 ); 1395 return $show_on_front_value; 1412 1413 // If we can't save it, revert. 1414 return _show_on_front_cant_create_pages(); 1396 1415 } 1397 } elseif ( $_POST['page_on_front'] ) {1398 update_option( 'page_on_front', $_POST['page_on_front'] );1399 } else {1400 // They didn't select a page at all. Sad face.1401 $show_on_front_value = 'posts';1402 update_option( 'page_on_front', 0 );1403 update_option( 'page_for_posts', 0 );1404 add_settings_error( 'page_on_front', 'no_page_selected', __( 'You must select a page to set a static front page.' ) );1405 return $show_on_front_value;1406 1416 } 1407 1408 // If a page for posts was meant to be specified, update/create it. 1409 if ( ! isset( $_POST['page_for_posts'] ) ) { 1410 update_option( 'page_for_posts', 0 ); 1417 1418 // PAGE_FOR_POSTS 1419 if ( ! isset( $_POST['page_for_posts_name'] ) ) { 1411 1420 return $show_on_front_value; 1412 1421 } 1413 1414 $page_for_posts = (int) $_POST['page_for_posts']; 1415 1416 if ( ! $page_for_posts || ! $page = get_post( $page_for_posts, ARRAY_A ) ) { 1417 update_option( 'page_for_posts', 0 ); 1418 return $show_on_front_value; 1422 1423 $existing_page_for_posts = get_page_by_path( stripslashes( $_POST['page_for_posts_name'] ) ); 1424 1425 if ( $existing_page_for_posts && $existing_page_for_posts->ID && 'publish' == $existing_page_for_posts->post_status && 'page' == $existing_page_for_posts->post_type ) { 1426 1427 // If a page exists with this same name, use it 1428 update_option( 'page_for_posts', (int) $existing_page_for_posts->ID ); 1429 } else { 1430 1431 // If the user can't create pages, revert. 1432 if ( ! current_user_can( 'create_posts', 'page' ) ) { 1433 return _show_on_front_cant_create_pages(); 1434 } 1435 1436 // Create new page 1437 $page_id = wp_insert_post( array( 1438 'post_title' => 'Latest posts', 1439 'post_name' => wp_strip_all_tags( $_POST['page_for_posts_name'] ), 1440 'post_type' => 'page', 1441 'post_status' => 'publish', 1442 'comment_status' => 'closed', 1443 'ping_status' => 'closed' 1444 ) ); 1445 1446 if ( $page_id ) { 1447 update_option( 'page_for_posts', $page_id ); 1448 } else { 1449 1450 // If we can't save it, revert. 1451 return _show_on_front_cant_create_pages(); 1452 } 1419 1453 } 1420 1454 1421 if ( 'page' != $page['post_type'] || ! current_user_can( 'edit_post', $page_for_posts ) ) {1422 update_option( 'page_for_posts', 0 );1423 return $show_on_front_value;1424 }1425 1426 if ( 'publish' != $page['post_status'] && ! current_user_can( 'publish_post', $page_for_posts ) ) {1427 update_option( 'page_for_posts', 0 );1428 return $show_on_front_value;1429 }1430 1431 $args = add_magic_quotes( $page );1432 $args['post_title'] = $_POST['page_for_posts_title'];1433 $args['post_name'] = $_POST['post_name'];1434 $args['post_status'] = 'publish';1435 if ( 'auto-draft' == $page['post_status'] ) {1436 $args['comment_status'] = 'closed';1437 $args['ping_status'] = 'closed';1438 }1439 1440 $page_id = wp_insert_post( $args );1441 update_option( 'page_for_posts', $page_id );1442 1443 1455 return $show_on_front_value; 1444 1456 } 1445 add_filter( 'sanitize_option_show_on_front', '_show_on_front_reading_settings' ); 1457 add_filter( 'sanitize_option_show_on_front', '_show_on_front_reading_settings' ); 1458 No newline at end of file -
wp-admin/edit-form-advanced.php
306 306 wp_nonce_field( 'autosave', 'autosavenonce', false ); 307 307 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); 308 308 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); 309 310 $latest_posts_page = ''; 311 312 if ( $post->ID == get_option( 'page_for_posts' ) ) { 313 314 $latest_posts_page = ' style="display: none;"'; 309 315 ?> 310 316 317 <div class="updated message"> 318 <p><?php echo sprintf(__("This page will display your <a href='%s'>latest posts</a>. As a result, you can't edit the body of this page. Visit <a href='%s'>reading settings</a> to change your 'front page displays' option."), 'options-reading.php', 'options-reading.php'); ?></p> 319 </div> 320 321 <?php } ?> 322 311 323 <div id="poststuff"> 312 324 313 325 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> … … 347 359 348 360 if ( post_type_supports($post_type, 'editor') ) { 349 361 ?> 350 <div id="postdivrich" class="postarea" >362 <div id="postdivrich" class="postarea" <?php echo $latest_posts_page; ?>> 351 363 352 364 <?php wp_editor($post->post_content, 'content', array('dfw' => true, 'tabfocus_elements' => 'sample-permalink,post-preview', 'editor_height' => 360) ); ?> 353 365 -
wp-admin/css/ie.css
601 601 602 602 * html #adminmenu div.wp-menu-image { 603 603 height: 29px; 604 } 604 } 605 No newline at end of file -
wp-admin/css/wp-admin.css
4343 4343 margin-top: 12px; 4344 4344 } 4345 4345 4346 .form-table input.tog {4347 margin-top: 2px;4348 margin-right: 2px;4349 float: left;4350 }4351 4352 4346 .form-table td p { 4353 4347 margin-top: 4px; 4354 4348 } … … 5040 5034 margin: -3px 3px; 5041 5035 } 5042 5036 5043 .js.options-reading-php .if-page-on-front, 5044 .js.options-reading-php .if-page-for-posts, 5045 .options-reading-php .if-new-front-page { 5037 #front-static-pages .pfp-wrapper { 5038 display: inline-block; 5039 position: relative; 5040 } 5041 5042 #front-static-pages .pfp-wrapper .description { 5043 white-space: nowrap; 5044 } 5045 5046 #front-static-pages .pfp-slash { 5047 left: 6px; 5048 position: absolute; 5049 top: 1px; 5050 } 5051 5052 #page_for_posts_name { 5053 margin: 0; 5054 padding-left: 8px; 5055 width: 170px; 5056 } 5057 5058 #page_on_front_title { 5059 margin: 0; 5060 width: 170px; 5061 } 5062 5063 #front-static-pages .page-options { 5046 5064 display: none; 5065 margin-top: 8px; 5047 5066 } 5048 .options-reading-php .page-on-front .if-page-on-front, 5049 .options-reading-php .page-for-posts .if-page-for-posts { 5067 5068 .page-options .sample-url { 5069 color: #888; 5070 font-size: 11px; 5071 } 5072 5073 .static-front-page #front-static-pages .page-options { 5050 5074 display: block; 5051 5075 } 5052 .options-reading-php .new-front-page .if-new-front-page {5053 display: inline;5054 }5055 5076 5056 5077 /*------------------------------------------------------------------------------ 5057 5078 21.0 - Admin Footer -
wp-admin/options-reading.php
16 16 $parent_file = 'options-general.php'; 17 17 18 18 wp_enqueue_script( 'sample-permalink' ); 19 wp_enqueue_script( 'jquery-ui-core' ); 20 wp_enqueue_script( 'jquery-ui-autocomplete' ); 19 21 20 22 /** 21 23 * Display JavaScript on the page. … … 23 25 * @since 3.5.0 24 26 */ 25 27 function options_reading_add_js() { 28 29 $all_pages = get_pages(); 30 31 // Populate autocomplete options 32 $page_titles_json = $page_names_json = array(); 33 34 foreach ( $all_pages as $page ) { 35 array_push( $page_titles_json, array( 36 'id' => $page->ID, 37 'label' => $page->post_title, 38 'post_name' => $page->post_name 39 ) ); 40 41 array_push( $page_names_json, array( 42 'id' => $page->ID, 43 'label' => $page->post_name, 44 'post_title' => $page->post_title 45 ) ); 46 } 26 47 ?> 27 48 <script> 28 jQuery(document).ready( function($) { 29 var section = $('#front-static-pages'); 30 $('#show_on_front').change( function() { 31 var checked = $(this).prop('checked'); 32 section.toggleClass('page-on-front', checked); 33 if ( checked ) 34 $('#page_for_posts').prop('checked', true).change(); 35 else 36 section.removeClass('page-for-posts'); 37 }); 38 $('#page_for_posts').change( function() { 39 section.toggleClass('page-for-posts', $(this).prop('checked')); 40 }); 41 $('#page_on_front').change( function() { 42 section.toggleClass('new-front-page', 'new' === $(this).val()); 43 }); 44 }); 49 jQuery( function( $ ) { 50 var pageTitles = <?php echo json_encode( $page_titles_json ); ?>, 51 pageNames = <?php echo json_encode( $page_names_json ); ?>; 52 53 $( document ).ready( function () { 54 $( '.tog' ).change( function () { 55 if ( 'page' === $( this ).val() ) { 56 $( '.form-table' ).addClass( 'static-front-page' ); 57 } else { 58 $( '.form-table' ).removeClass( 'static-front-page' ); 59 } 60 }); 61 $( '#page_on_front_title' ).keyup( function () { 62 63 // Hide edit link 64 $( this ).parent().find( '.description' ).hide(); 65 }); 66 $( '#page_for_posts_name' ).keyup( function () { 67 thisVal = $( this ).val(); 68 69 // Update example URL 70 $( '.page_for_posts_url' ).html( thisVal ); 71 72 // Hide edit link 73 $( this ).parent().find( '.description' ).hide(); 74 }); 75 }); 76 77 addAutocomplete( 'page_on_front_title', pageTitles, 'page_on_front' ); 78 addAutocomplete( 'page_for_posts_name', pageNames, 'page_for_posts' ); 79 80 function addAutocomplete ( textbox, source, hidden ) { 81 $( '#' + textbox ).autocomplete( { 82 source: source, 83 minLength: 1, 84 delay: 0, 85 autoFocus: true, 86 response: function( event, ui ) { 87 88 // If this value doesn't exist in dropdown, show 'add new page' option at top 89 if ( ! isNewPage( source, $( this ).val() ) ) { 90 ui.content.unshift( { 91 'id': 0, 92 'label': '-- Add new page --', 93 'post_name': null 94 } ); 95 } 96 }, 97 select: function( event, ui ) { 98 var thisVal = $( this ).val(); 99 100 // Update example URL on click 101 if ( 'page_for_posts_name' === textbox ) 102 $( '.page_for_posts_url' ).html( ui.item.label ); 103 104 if ( 0 === ui.item.id ){ 105 setTimeout( function () { 106 $( '#' + textbox ).val( thisVal ).focus(); 107 }, 30); 108 } 109 110 if ( ui.item.id ) { 111 var thisId = ui.item.id; 112 } else { 113 var thisId = 'new'; 114 } 115 $( '#' + hidden ).val( thisId ); 116 } 117 } ); 118 } 119 function isNewPage ( source, label ) { 120 121 for ( i=0; i<source.length; i++ ) { 122 if ( label === source[i].label ) 123 return true; 124 } 125 126 return false; 127 } 128 } ); 45 129 </script> 46 130 <?php 47 131 } … … 90 174 <?php 91 175 settings_fields( 'reading' ); 92 176 wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); 93 ?>94 <table class="form-table">95 <?php96 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )97 add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );98 177 99 178 $classes = ''; 100 179 if ( 'page' == get_option( 'show_on_front' ) ) { 101 if ( ! get_pages() || ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) { 180 $classes = 'static-front-page'; 181 /*if ( ! get_pages() || ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) { 102 182 update_option( 'show_on_front', 'posts' ); 103 183 } else { 104 $classes = 'page-on-front'; 105 if ( get_option( 'page_for_posts' ) ) 106 $classes .= ' page-for-posts'; 107 } 184 $classes = 'static-front-page'; 185 }*/ 108 186 } 187 ?> 188 <table class="form-table <?php echo $classes; ?>"> 189 <?php 190 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) 191 add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) ); 109 192 110 $ all_pages = get_pages();111 $ new_front_page_only = ! get_option( 'page_on_front' ) && ( ! $all_pages || ( 1 == count( $all_pages ) && __( 'sample-page' ) == $all_pages[0]->post_name) );193 $page_on_front = get_post( get_option( 'page_on_front' ) ); 194 $page_for_posts = get_post( get_option( 'page_for_posts' ) ); 112 195 113 if ( current_user_can( 'create_posts', 'page' ) && ! ( get_option( 'page_for_posts' ) && $page_for_posts = get_post( get_option( 'page_for_posts' ) ) ) ) { 114 $title = _x( 'Blog', 'default page for posts title' ); 115 // @todo What if the found page is post_type = attachment or post_status != publish? 116 // We could go ahead and create a new one, but we would not be able to take over 117 // the slug from another page. (We could for an attachment.) 118 // We must also check that the user can edit this page and publish a page. 119 // Otherwise, we must assume they cannot create pages (throughout), and thus 120 // should fall back to the dropdown. 121 $page_for_posts = get_page_by_path( sanitize_title( $title ) ); 122 if ( ! $page_for_posts || $page_for_posts->ID == get_option( 'page_on_front' ) ) { 123 $page_for_posts = get_default_post_to_edit( 'page', true ); 124 $page_for_posts->post_title = $title; 125 $page_for_posts->post_name = sanitize_title( $title ); 126 } 196 if ( ! isset( $page_on_front ) ) { 197 // Default for page_on_front 198 $page_on_front->post_title = 'Home'; 199 } else { 200 // Show link to edit page if it exists 201 $page_on_front_helper_text = sprintf(__( '<span class="description"> (<a href="%s">Edit</a>)</span>' ), 'post.php?post=' . $page_on_front->ID . '&action=edit' ); 127 202 } 128 203 129 if ( ! $new_front_page_only || current_user_can( 'create_posts', 'page' ) ) : ?> 130 <tr valign="top"> 131 <th scope="row"><?php _e( 'Enable a static front page' ); ?></th> 132 <td id="front-static-pages" class="<?php echo $classes; ?>"> 133 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Enable a static front page' ); ?></span></legend> 134 <p><label for="show_on_front"> 135 <input id="show_on_front" name="show_on_front" type="checkbox" value="page" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> /> 136 <?php printf( __( 'Show a <a href="%s">page</a> instead of your latest posts' ), 'edit.php?post_type=page' ); ?> 137 </label></p> 138 <p class="if-page-on-front sub-option"> 139 <?php if ( $new_front_page_only ) : // If no pages, or only sample page, only allow a new page to be added ?> 140 <label for="page_on_front_title"><?php _e( 'Add new page titled:' ); ?> 141 <?php else : ?> 142 <label for="page_on_front"> 143 <select name="page_on_front" id="page_on_front"> 144 <option value="0"><?php _e( '— Select —' ); ?></option> 145 <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?> 146 <option value="new" id="new-page"><?php _e( '— Add new page —' ); ?></option> 147 <?php endif; ?> 148 <?php echo walk_page_dropdown_tree( $all_pages, 0, array( 'selected' => get_option( 'page_on_front' ) ) ); ?> 149 </select> 150 </label> 151 <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?> 152 <label for="page_on_front_title" class="if-new-front-page"><?php _e( 'titled:' ); ?> 153 <?php endif; ?> 154 <?php endif; ?> 155 <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?> 156 <input name="page_on_front_title" type="text" id="page_on_front_title" value="<?php echo esc_attr_x( 'Home', 'default page on front title' ); ?>" /> 157 </label> 158 <?php endif; ?> 159 </p> 160 <p class="if-page-on-front"><label for="page_for_posts"> 161 <input id="page_for_posts" name="page_for_posts" type="checkbox" value="<?php echo $page_for_posts->ID; ?>" <?php checked( (bool) get_option( 'page_for_posts' ) ); ?> /> 162 <?php _e( 'Show latest posts on a separate page' ); ?> 163 </label></p> 164 <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?> 165 <p class="if-page-for-posts sub-option"><label for="page_for_posts_title"><?php _e( 'Page title:' ); ?> 166 <input name="page_for_posts_title" type="text" id="page_for_posts_title" value="<?php echo esc_attr( htmlspecialchars( $page_for_posts->post_title ) ); ?>" /> 167 </label></p> 168 <p class="if-page-for-posts sub-option" id="edit-slug-box"> 169 <?php echo get_sample_permalink_html( $page_for_posts->ID, $page_for_posts->post_title, $page_for_posts->post_name ); ?> 170 </p> 171 <input name="post_name" type="hidden" id="post_name" value="<?php echo esc_attr( apply_filters( 'editable_slug', $page_for_posts->post_name ) ); ?>" /> 172 <?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?> 173 <div class="error inline"><p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'These pages should not be the same!' ); ?></p></div> 174 <?php endif; ?> 175 </fieldset> 176 <?php else : // cannot create pages, so fall back to a selector of existing pages ?> 177 <p class="if-page-for-posts sub-option"><label for="page_for_posts"> 178 <?php wp_dropdown_pages( array( 179 'name' => 'page_for_posts', 'show_option_none' => __( '— Select —' ), 180 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) 181 ) ); ?> 182 <?php endif; // create pages ?> 183 </td> 204 if ( ! isset( $page_for_posts ) ) { 205 // Default for page_for_posts 206 $page_for_posts->post_name = 'blog'; 207 } else { 208 // Show link to edit page if it exists 209 $page_for_posts_helper_text = sprintf(__( '<span class="description"> (<a href="%s">Edit</a>)</span>' ), 'post.php?post=' . $page_for_posts->ID . '&action=edit' ); 210 } 211 ?> 212 213 <tr> 214 <th scope="row"><?php _e( 'Front page displays' ); ?></th> 215 <td id="front-static-pages" class="<?php echo $classes; ?>"> 216 <fieldset> 217 <legend class="screen-reader-text"> 218 <span><?php _e( 'Front page displays' ); ?></span> 219 </legend> 220 <label> 221 <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> /> 222 <span class="radio-label"><?php _e( 'Your latest posts' ); ?></span> 223 </label> 224 <br /> 225 <label> 226 <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> /> 227 <span class="radio-label"><?php _e( 'A static page' ); ?></span> 228 </label> 229 <div class="page-options"> 230 <label> 231 <?php _e( 'Enter a title for your static front page.' ); ?><br /> 232 <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?> 233 <input name="page_on_front_title" type="text" id="page_on_front_title" value="<?php echo esc_attr_x( $page_on_front->post_title, 'default page on front title' ); ?>" /> 234 <?php echo $page_on_front_helper_text; ?> 235 <?php else : // cannot create pages, so fall back to a selector of existing pages ?> 236 <?php wp_dropdown_pages( array( 237 'name' => 'page_on_front', 'show_option_none' => __( '— Select —' ), 238 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) 239 ) ); ?> 240 <?php endif; // cannot create pages ?> 241 </label> 242 </div> 243 <div class="page-options"> 244 <label> 245 <?php _e( 'Choose a URL for your latests posts.' ); ?><br /> 246 <div class="pfp-wrapper"> 247 <?php if ( current_user_can( 'create_posts', 'page' ) ) : ?> 248 <div class="pfp-slash">/</div> 249 <input name="page_for_posts_name" type="text" id="page_for_posts_name" value="<?php echo esc_attr_x( $page_for_posts->post_name, 'default page for posts name' ); ?>" /> 250 <?php echo $page_for_posts_helper_text; ?> 251 <br /> 252 <span class="sample-url"><?php echo get_site_url(); ?>/<strong class="page_for_posts_url"><?php echo $page_for_posts->post_name; ?></strong></span> 253 <?php else : // cannot create pages, so fall back to a selector of existing pages ?> 254 <?php wp_dropdown_pages( array( 255 'name' => 'page_for_posts', 'show_option_none' => __( '— Select —' ), 256 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) 257 ) ); ?> 258 <?php endif; // cannot create pages ?> 259 </div> 260 </label> 261 </div> 262 </fieldset> 263 </td> 184 264 </tr> 185 <?php endif; // if no pages to choose from and can't create pages ?>186 265 187 266 <tr valign="top"> 188 267 <th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>