[wp-trac] [WordPress Trac] #13535: get_query_var() not working as expected.

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 9 03:47:46 UTC 2010


#13535: get_query_var() not working as expected.
--------------------------------------+-------------------------------------
 Reporter:  pmdci                     |        Owner:  ryan    
     Type:  defect (bug)              |       Status:  reopened
 Priority:  normal                    |    Milestone:  3.0     
Component:  Query                     |      Version:  3.0     
 Severity:  major                     |   Resolution:          
 Keywords:  post_types get_query_var  |  
--------------------------------------+-------------------------------------

Comment(by pmdci):

 Here is the correct code to achieve the results I was expecting:

 {{{
 <?php
   $post_type = get_post_type( $post );
   if ( is_single() &&  $post_type == 'post' ) { include 'dashboard.php'; }
 ?>
   <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) :
 ?>
 }}}

 The issue is that '''is_post_type()''' sounds confusing, because it
 suggest that it checks for the current post type when in fact, as said
 previously, it checks if the post type in question is registered on the in
 the system. The codex for the '''is_post_type()''' function has been
 amended to clarify this.

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


More information about the wp-trac mailing list