Make WordPress Core

Ticket #2515: front_page.2.diff

File front_page.2.diff, 4.0 KB (added by ryan, 20 years ago)

Update

  • wp-includes/classes.php

     
    293293                        $q['what_to_show'] = 'posts';
    294294                }
    295295
     296                if ( $this->is_home && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
     297                        $this->is_page = true;
     298                        $this->is_home = false;
     299                        $q['page_id'] = get_option('page_on_front');
     300                }
     301
    296302                if (isset($q['page'])) {
    297303                        $q['page'] = trim($q['page'], '/');
    298304                        $q['page'] = (int) $q['page'];
     
    363369                                $reqpage = $reqpage->ID;
    364370                        else
    365371                                $reqpage = 0;
    366                         $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
    367                         $page_paths = '/' . trim($q['pagename'], '/');
    368                         $q['pagename'] = sanitize_title(basename($page_paths));
    369                         $q['name'] = $q['pagename'];
    370372
    371                         $where .= " AND (ID = '$reqpage')";
     373                        if  ( ('page' == get_option('show_on_front') ) && ( $reqpage == get_option('page_for_posts') ) ) {
     374                                $this->is_page = false;
     375                                $this->is_home = true;
     376                        } else {
     377                                $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
     378                                $page_paths = '/' . trim($q['pagename'], '/');
     379                                $q['pagename'] = sanitize_title(basename($page_paths));
     380                                $q['name'] = $q['pagename'];
     381                                $where .= " AND (ID = '$reqpage')";
     382                        }
    372383                } elseif ('' != $q['attachment']) {
    373384                        $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
    374385                        $attach_paths = '/' . trim($q['attachment'], '/');
     
    397408
    398409                if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) {
    399410                        $q['page_id'] = intval($q['page_id']);
    400                         $q['p'] = $q['page_id'];
    401                         $where = ' AND ID = '.$q['page_id'];
     411                        if  ( ('page' == get_option('show_on_front') ) && ( $q['page_id'] == get_option('page_for_posts') ) ) {
     412                                $this->is_page = false;
     413                                $this->is_home = true;
     414                        } else {
     415                                $q['p'] = $q['page_id'];
     416                                $where = ' AND ID = '.$q['page_id'];
     417                        }
    402418                }
    403419
    404420                // If a search pattern is specified, load the posts that match
  • wp-admin/options-reading.php

     
    99
    1010<div class="wrap">
    1111<h2><?php _e('Reading Options') ?></h2>
    12 <form name="form1" method="post" action="options.php">
     12<form name="form1" method="post" action="options.php">
     13
     14<?php if ( get_pages() ): ?>
    1315<fieldset class="options">
     16<legend><?php _e('Front Page') ?></legend>
     17<table width="100%" cellspacing="2" cellpadding="5" class="editform">
     18<tr valign="top">
     19<th width="33%" scope="row"></th>
     20<td>
     21<p>
     22        <label>
     23                <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
     24<?php _e('Show the latest posts on the front page'); ?>
     25   </label>
     26</p>
     27<p>
     28        <label>
     29                <input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
     30                <?php printf(__('Show %s on the front page'), wp_dropdown_pages("name=page_on_front&echo=0&selected=" . get_option('page_on_front'))); ?><br />
     31                <?php printf(__('Show the latest posts on %s'), wp_dropdown_pages("name=page_for_posts&echo=0&selected=" . get_option('page_for_posts'))); ?>
     32   </label>
     33</p>
     34</td>
     35</tr>
     36</table>
     37</fieldset>
     38<?php endif; ?>
     39
     40<fieldset class="options">
    1441<legend><?php _e('Blog Pages') ?></legend>
    1542<table width="100%" cellspacing="2" cellpadding="5" class="editform">
    1643<tr valign="top">
     
    5582</p>
    5683<p class="submit">
    5784<input type="hidden" name="action" value="update" />
    58 <input type="hidden" name="page_options" value="posts_per_page,what_to_show,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression" />
     85<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" />
    5986<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
    6087</p>
    6188</form>