[wp-trac] [WordPress Trac] #14304: problem with post_type on custom post type in Loop

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 14 11:52:45 UTC 2010


#14304: problem with post_type on custom post type in Loop
--------------------------+-------------------------------------------------
 Reporter:  niceandripe   |       Owner:  frankperez87     
     Type:  defect (bug)  |      Status:  accepted         
 Priority:  normal        |   Milestone:  Awaiting Review  
Component:  Post Types    |     Version:  3.0              
 Severity:  normal        |    Keywords:  custom post types
--------------------------+-------------------------------------------------
Changes (by frankperez87):

  * owner:  => frankperez87
  * status:  new => accepted


Comment:

 Looks like you are always setting your $post_type = 'directory';
 To do a check you would need to use == rather than =.

 Check the code below, it should do the trick.

 {{{
 <?php if ( in_category( _x('gallery', 'gallery category slug') ) ) : ?>

    XXX - this is what i expect for gallery posts

 <?php elseif ( $post_type == 'directory' ) : ?>

    YYY - this is what i expect for directory (custom) posts

 <?php else : ?>

    ZZZ - this is what i expect for regular posts

 <?php endif;  ?>
 }}}

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


More information about the wp-trac mailing list