Index: wp-admin/css/wp-admin.css =================================================================== --- wp-admin/css/wp-admin.css (revision 21851) +++ wp-admin/css/wp-admin.css (working copy) @@ -2870,6 +2870,10 @@ font-size: 11px; } +#front-static-pages #edit-slug-box { + padding: 0; +} + #editable-post-name-full { display: none; } Index: wp-admin/includes/post.php =================================================================== --- wp-admin/includes/post.php (revision 21851) +++ wp-admin/includes/post.php (working copy) @@ -1055,9 +1055,15 @@ * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. */ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { - global $wpdb; + global $wpdb, $current_screen; + $post = get_post($id); + if ( isset( $current_screen ) ) + $context = $current_screen->id; + else + $context = isset( $_POST['context'] ) ? $_POST['context'] : ''; + list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); if ( 'publish' == $post->post_status ) { @@ -1068,11 +1074,12 @@ $title = __('Temporary permalink. Click to edit this part.'); } - if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { - $return = '' . __('Permalink:') . "\n" . '' . $permalink . "\n"; + if ( false === strpos( $permalink, '%postname%' ) && false === strpos( $permalink, '%pagename%' ) ) { + $return = ( 'options-reading' == $context ) ? __( 'Located at' ) . "\n" : '' . __( 'Permalink:' ) . "\n"; + $return .= '' . $permalink . "\n"; if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) $return .= '' . __('Change Permalinks') . "\n"; - if ( isset($view_post) ) + if ( isset( $view_post ) && 'options-reading' == $context ) $return .= "$view_post\n"; $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); @@ -1095,14 +1102,14 @@ } $post_name_html = '' . $post_name_abridged . ''; - $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink); - $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink); - $return = '' . __('Permalink:') . "\n"; + $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, $permalink ); + $view_link = str_replace( array( '%pagename%', '%postname%' ), $post_name, $permalink ); + $return = ( 'options-reading' == $context ) ? __( 'Located at' ) . "\n" : '' . __( 'Permalink:' ) . "\n"; $return .= '' . $display_link . "\n"; $return .= ''; // Fix bi-directional text display defect in RTL languages. $return .= ' \n"; $return .= '' . $post_name . "\n"; - if ( isset($view_post) ) + if ( isset( $view_post ) && 'options-reading' != $context ) $return .= "$view_post\n"; $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); @@ -1318,3 +1325,41 @@ return $url; } + +/** + * Creates new pages to be set as a front page or a page for posts in Reading Settings. + * + * @since 3.5.0 + * @access private + */ +function _create_pages_for_reading_settings() { + if ( ! isset( $_POST['show_on_front'] ) ) + return; + + $post_type = get_post_type_object( 'page' ); + if ( ! current_user_can( $post_type->cap->edit_posts ) ) + wp_die( __( 'You are not allowed to create pages on this site.' ) ); + + if ( isset( $_POST['page_on_front'] ) && 'new' == $_POST['page_on_front'] ) { + $page_id = wp_insert_post( array( + 'post_title' => esc_html( stripslashes( $_POST['page_on_front_title'] ) ), + 'post_type' => 'page', + 'post_status' => 'publish' + ) ); + + if ( $page_id && ! is_wp_error( $page_id ) ) + $_POST['page_on_front'] = $page_id; + } + + if ( isset( $_POST['page_for_posts'] ) ) { + if ( ! $page = get_post( (int) $_POST['page_for_posts'] ) ) + return; + + $page->post_title = esc_html( stripslashes( $_POST['page_for_posts_title'] ) ); + $page->post_name = esc_html( stripslashes( $_POST['post_name'] ) ); + $page->post_status = 'publish'; + + wp_update_post( $page ); + } +} +add_action( 'admin_init', '_create_pages_for_reading_settings' ); Index: wp-admin/js/post.js =================================================================== --- wp-admin/js/post.js (revision 21851) +++ wp-admin/js/post.js (working copy) @@ -569,6 +569,7 @@ post_id: post_id, new_slug: new_slug, new_title: $('#title').val(), + context: pagenow, samplepermalinknonce: $('#samplepermalinknonce').val() }, function(data) { $('#edit-slug-box').html(data); Index: wp-admin/options-reading.php =================================================================== --- wp-admin/options-reading.php (revision 21851) +++ wp-admin/options-reading.php (working copy) @@ -15,6 +15,8 @@ $title = __( 'Reading Settings' ); $parent_file = 'options-general.php'; +wp_enqueue_script( 'post' ); + /** * Display JavaScript on the page. * @@ -25,22 +27,57 @@ ?> \n"; + $output .= "\t\n"; + $output .= "\t\n"; + $pages = get_pages( $r ); + if ( ! empty( $pages ) ) + $output .= walk_page_dropdown_tree( $pages, 0, $r ); + $output .= "\n"; + + return apply_filters( 'wp_dropdown_pages', $output ); +} + get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), @@ -73,6 +110,7 @@