Make WordPress Core

Ticket #2515: front_page.diff

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

First pass with rough UI

  • wp-includes/classes.php

     
    293293                        $q['what_to_show'] = 'posts';
    294294                }
    295295
     296                if ( $this->is_home ) {
     297                        if ( 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
     298                                $this->is_page = true;
     299                                $this->is_home = false;
     300                                $q['page_id'] = get_option('page_on_front');
     301                        }
     302                }
     303
    296304                if (isset($q['page'])) {
    297305                        $q['page'] = trim($q['page'], '/');
    298306                        $q['page'] = (int) $q['page'];
     
    359367                        $where .= " AND post_name = '" . $q['name'] . "'";
    360368                } else if ('' != $q['pagename']) {
    361369                        $reqpage = get_page_by_path($q['pagename']);
    362                         $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
    363                         $page_paths = '/' . trim($q['pagename'], '/');
    364                         $q['pagename'] = sanitize_title(basename($page_paths));
    365                         $q['name'] = $q['pagename'];
    366 
    367                         $where .= " AND (ID = '$reqpage')";
     370                       
     371                        if  ( ('page' == get_option('show_on_front') ) && ( $reqpage == get_option('page_for_posts') ) ) {
     372                                $this->is_page = false;
     373                        } else {
     374                                $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
     375                                $page_paths = '/' . trim($q['pagename'], '/');
     376                                $q['pagename'] = sanitize_title(basename($page_paths));
     377                                $q['name'] = $q['pagename'];
     378                                $where .= " AND (ID = '$reqpage')";
     379                        }
    368380                } elseif ('' != $q['attachment']) {
    369381                        $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
    370382                        $attach_paths = '/' . trim($q['attachment'], '/');
     
    393405
    394406                if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) {
    395407                        $q['page_id'] = intval($q['page_id']);
    396                         $q['p'] = $q['page_id'];
    397                         $where = ' AND ID = '.$q['page_id'];
     408                        if  ( ('page' == get_option('show_on_front') ) && ( $q['page_id'] == get_option('page_for_posts') ) ) {
     409                                $this->is_page = false;
     410                        } else {
     411                                $q['p'] = $q['page_id'];
     412                                $where = ' AND ID = '.$q['page_id'];
     413                        }
    398414                }
    399415
    400416                // 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
    1314<fieldset class="options">
     15<legend><?php _e('Front Page') ?></legend>
     16<table width="100%" cellspacing="2" cellpadding="5" class="editform">
     17<tr valign="top">
     18<th width="33%" scope="row"></th>
     19<td>
     20<p>
     21        <label>
     22                <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
     23<?php _e('Show the latest posts on the front page'); ?>
     24   </label>
     25</p>
     26<p>
     27        <label>
     28                <input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
     29                <?php printf(__('Show %s on the front page'), wp_dropdown_pages("name=page_on_front&echo=0&selected=" . get_option('page_on_front'))); ?><br />
     30                <?php printf(__('Show the latest posts on %s'), wp_dropdown_pages("name=page_for_posts&echo=0&selected=" . get_option('page_for_posts'))); ?>
     31   </label>
     32</p>
     33</td>
     34</tr>
     35</table>
     36</fieldset>
     37
     38<fieldset class="options">
    1439<legend><?php _e('Blog Pages') ?></legend>
    1540<table width="100%" cellspacing="2" cellpadding="5" class="editform">
    1641<tr valign="top">
     
    5580</p>
    5681<p class="submit">
    5782<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" />
     83<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" />
    5984<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
    6085</p>
    6186</form>