What's up front? #2515

git-svn-id: https://develop.svn.wordpress.org/trunk@3581 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-03-01 07:08:04 +00:00
parent 0b9513d43c
commit 55ba231f8e
5 changed files with 58 additions and 11 deletions

View File

@ -10,6 +10,36 @@ include('admin-header.php');
<div class="wrap">
<h2><?php _e('Reading Options') ?></h2>
<form name="form1" method="post" action="options.php">
<?php if ( get_pages() ): ?>
<fieldset class="options">
<legend><?php _e('Front Page') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th width="33%" scope="row"></th>
<td>
<p>
<label>
<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
<?php _e('Show the latest posts on the front page'); ?>
</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(__('Show another <a href="%s">page</a> on the front page (Select below)'), 'edit-pages.php'); ?>
</label>
</p>
<p>
<?php printf(__('Show this page on the front page: %s'), wp_dropdown_pages("name=page_on_front&echo=0&selected=" . get_option('page_on_front'))); ?><br />
<?php printf(__('Show the latest posts on this page: %s'), wp_dropdown_pages("name=page_for_posts&echo=0&selected=" . get_option('page_for_posts'))); ?>
</p>
</td>
</tr>
</table>
</fieldset>
<?php endif; ?>
<fieldset class="options">
<legend><?php _e('Blog Pages') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
@ -55,7 +85,7 @@ include('admin-header.php');
</p>
<p class="submit">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="posts_per_page,what_to_show,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression" />
<input type="hidden" name="page_options" value="posts_per_page,what_to_show,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression,show_on_front,page_on_front,page_for_posts" />
<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
</p>
</form>

View File

@ -34,7 +34,7 @@ function upgrade_all() {
if ( $wp_current_db_version < 3308 )
upgrade_160();
if ( $wp_current_db_version < 3570 )
if ( $wp_current_db_version < 3582 )
upgrade_210();
$wp_rewrite->flush_rules();

View File

@ -242,6 +242,7 @@ function populate_options() {
// 2.1
add_option('blog_public', 1);
add_option('default_link_category', 2);
add_option('show_on_front', 'posts');
// Delete unused options
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog');

View File

@ -293,6 +293,12 @@ class WP_Query {
$q['what_to_show'] = 'posts';
}
if ( $this->is_home && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
$this->is_page = true;
$this->is_home = false;
$q['page_id'] = get_option('page_on_front');
}
if (isset($q['page'])) {
$q['page'] = trim($q['page'], '/');
$q['page'] = (int) $q['page'];
@ -363,12 +369,17 @@ class WP_Query {
$reqpage = $reqpage->ID;
else
$reqpage = 0;
$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
$page_paths = '/' . trim($q['pagename'], '/');
$q['pagename'] = sanitize_title(basename($page_paths));
$q['name'] = $q['pagename'];
$where .= " AND (ID = '$reqpage')";
if ( ('page' == get_option('show_on_front') ) && ( $reqpage == get_option('page_for_posts') ) ) {
$this->is_page = false;
$this->is_home = true;
} else {
$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
$page_paths = '/' . trim($q['pagename'], '/');
$q['pagename'] = sanitize_title(basename($page_paths));
$q['name'] = $q['pagename'];
$where .= " AND (ID = '$reqpage')";
}
} elseif ('' != $q['attachment']) {
$q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
$attach_paths = '/' . trim($q['attachment'], '/');
@ -397,8 +408,13 @@ class WP_Query {
if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) {
$q['page_id'] = intval($q['page_id']);
$q['p'] = $q['page_id'];
$where = ' AND ID = '.$q['page_id'];
if ( ('page' == get_option('show_on_front') ) && ( $q['page_id'] == get_option('page_for_posts') ) ) {
$this->is_page = false;
$this->is_home = true;
} else {
$q['p'] = $q['page_id'];
$where = ' AND ID = '.$q['page_id'];
}
}
// If a search pattern is specified, load the posts that match

View File

@ -3,6 +3,6 @@
// This just holds the version number, in a separate file so we can bump it without cluttering the SVN
$wp_version = '2.1-alpha1';
$wp_db_version = 3570;
$wp_db_version = 3582;
?>