[wp-trac] [WordPress Trac] #19958: Allow custom post types as "home"

WordPress Trac noreply at wordpress.org
Wed Nov 21 00:02:01 UTC 2012


#19958: Allow custom post types as "home"
----------------------------+------------------------------
 Reporter:  sooskriszta     |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.3.1
 Severity:  major           |  Resolution:
 Keywords:                  |
----------------------------+------------------------------

Comment (by pbearne):

 We could just reverse this


 {{{
         if ( 'page' == $post_type_name ) {
 }}}


 becomes


 {{{
         if ( 'post' != $post_type_name ) {
 }}}


 and let the
 {{{
 if ( ! empty( $front_page ) ) {
 }}}
 do it's stuff for all the menu types but this would mean that the code
 will run more than needed

 So the other way would to do a look-up for the page type that is used for
 the home page test for that setting 'page' as the default as we might not
 get anything back

 {{{

 $front_page_type = 'page' == get_option('show_on_front') ?
                  get_post_type((int) get_option( 'page_on_front' )) :
 'page';

 if($front_page_type == $post_type_name ){
  ...

 }}}

 If this works it's better and cover all the bases


 or this might be even better

 {{{

 $front_page_type = 'page' == get_option('show_on_front') ?
                  get_post_type((int) get_option( 'page_on_front' )) :
 null;

 if($front_page_type == $post_type_name ){
  ...

 }}}


 Paul

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


More information about the wp-trac mailing list