Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#13507 closed defect (bug) (invalid)

Conditional tag for post type and taxonomy

Reported by: ojp3d's profile ojp3d Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description

I'm using MAMP on a Mac, and trying to filter posts using conditional tags, but other posts are passing...

( is_post_type( 'sermons' ) && is_taxonomy( 'preacher' )
is_taxonomy( 'series' ) )

It still doesn't work when I try just:

( is_taxonomy( 'preacher' )
is_taxonomy( 'series' ) )

I'm running the latest beta. And it is not a problem of wp_reset_query()... I tested without any query before.

Change History (4)

#1 @ojp3d
16 years ago

The codes are:

( is_post_type( 'sermons' ) && is_taxonomy( 'preacher' ) || is_taxonomy( 'series' ) )
is_taxonomy( 'preacher' ) || is_taxonomy( 'series' )

#2 @westi
16 years ago

  • Cc westi added
  • Keywords reporter-feedback added
  • Priority changed from high to normal

What intersection are you trying to achieve?

Could you attach some example code with the calls for registering the post_types and taxonomies so we can reproduce.

Cheers

#3 @nacin
16 years ago

Neither of these are conditional tags. is_taxonomy and is_post_type tell you if it is registered.

For conditional tags, you'll want is_tax, and probably is_singular (we haven't acted on #12588 yet).

#4 @dd32
16 years ago

  • Milestone 3.0 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Neither of these are conditional tags. is_taxonomy and is_post_type tell you if it is registered.

Correct, Which is why this isn't working as expected.

use is_tax() + and the result from #12588

Note: See TracTickets for help on using tickets.