WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #31957, comment 2


Ignore:
Timestamp:
04/13/2015 07:43:18 AM (7 years ago)
Author:
selnomeria
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31957, comment 2

    initial v1  
    11sorry, same problem for 'pages' ,not only posts.. so, the same custom query is needed---
    22{{{
    3 $page=get_page_by_path(...., ..., 'page');
    4 if ($page) ....
     3//PAGE exists... with the found slug("TORNADOO"), lets check if it's a really page..
     4$page=get_page_by_path('cars/subcat/TORNADOO', OBJECT, 'page');
     5if ($page){
     6        //new query
     7        $query->init();
     8        $query->parse_query(   array('post_type' =>'page')  ) ;
     9        //others
     10        $query->is_home = false;
     11        $query->is_single = false;
     12        $query->is_singular = true;
     13        $query->is_page = true;
     14        $query->queried_object_id = $page->ID;
     15        $query->set( 'page_id', $page->ID );
     16        return;
     17}
    518}}}