Ticket #2959: posts-page.diff

File posts-page.diff, 1.6 KB (added by skeltoac, 6 years ago)
  • wp-includes/query.php

     
    279279        var $is_admin = false; 
    280280        var $is_attachment = false; 
    281281        var $is_robots = false; 
     282        var $is_posts_page = false; 
    282283 
    283284        function init_query_flags() { 
    284285                $this->is_single = false; 
     
    300301                $this->is_admin = false; 
    301302                $this->is_attachment = false; 
    302303                $this->is_robots = false; 
     304                $this->is_posts_page = false; 
    303305        } 
    304306 
    305307        function init () { 
     
    627629                        if  ( ('page' == get_option('show_on_front') ) && ( $reqpage == get_option('page_for_posts') ) ) { 
    628630                                $this->is_page = false; 
    629631                                $this->is_home = true; 
     632                                $this->is_posts_page = true; 
    630633                        } else { 
    631634                                $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename']))); 
    632635                                $page_paths = '/' . trim($q['pagename'], '/'); 
     
    665668                        if  ( ('page' == get_option('show_on_front') ) && ( $q['page_id'] == get_option('page_for_posts') ) ) { 
    666669                                $this->is_page = false; 
    667670                                $this->is_home = true; 
     671                                $this->is_posts_page = true; 
    668672                        } else { 
    669673                                $q['p'] = $q['page_id']; 
    670674                                $where = ' AND ID = '.$q['page_id']; 
     
    10181022                        $category = &get_category($cat); 
    10191023                        $this->queried_object = &$category; 
    10201024                        $this->queried_object_id = $cat; 
     1025                } else if ($this->is_posts_page) { 
     1026                        $this->queried_object = & get_page(get_option('page_for_posts')); 
     1027                        $this->queried_object_id = $this->queried_object->ID; 
    10211028                } else if ($this->is_single) { 
    10221029                        $this->queried_object = $this->post; 
    10231030                        $this->queried_object_id = $this->post->ID;