[wp-trac] [WordPress Trac] #19958: Allow custom post types as "home" and get_posts() to return results for more than one post type

WordPress Trac noreply at wordpress.org
Tue Jan 22 15:57:14 UTC 2013


#19958: Allow custom post types as "home" and get_posts() to return results for
more than one post type
-------------------------------------------------+-------------------------
 Reporter:  sooskriszta                          |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Administration                       |  Review
 Severity:  major                                |     Version:  3.3.1
 Keywords:  has-patch needs-testing needs-codex  |  Resolution:
-------------------------------------------------+-------------------------

Comment (by pbearne):

 Hi All

 I need a bit of help to finish this

 I have one last bug and need a code review as the function I added to
 options-reading needs to be move to better location.

 The bug: WordPress doesn't render the custom page at the root all I am
 getting the 404 page

 if you look at line 109 in query.php you will see I have remove the
 hardcoded "page" and pass in the current page type.

 Without this change the custom page loads but with the URL of
 /pagetype/pagename and not at the root /

 With this change I am getting the 404 so there is an additional change
 needed somewhere


 I am sure that this will come back for some rework on variable name etc.


 use this function to test, Note the 'show_in_home_page_list'=> true, which
 how I am declaring that this custom post should be added to the list

 {{{
 add_action( 'init', 'create_post_type' );
 function create_post_type() {
         register_post_type( 'acme_product',
                 array(
                         'labels' => array(
                                 'name' => __( 'tests' ),
                                 'singular_name' => __( 'test' )
                         ),
                         'public' => true,
                         'has_archive' => true,
                         'rewrite' => array('slug' => 'tests'),
                         'hierarchical' => true,
                         'show_in_home_page_list'=> true,
                 )
         );
 }
 }}}

 I have tried to remove all the hard code strings so in itself will an
 improvement.

 All and any help to finish this gratefully accepted.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19958#comment:21>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list