[wp-hackers] Is this a bug? - is_archive()
Bill Erickson
bill.erickson at gmail.com
Mon Oct 17 15:16:41 UTC 2011
I believe you should be using is_post_type_archive( $post_type ).
If you look in the code (
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/query.php )
is_archive() doesn't accept a post type parameter
---
Bill Erickson
WordPress Consultant
http://www.billerickson.net
On Mon, Oct 17, 2011 at 10:14 AM, Robert Lusby <nanogwp at gmail.com> wrote:
> I have two seperate custom post types - let's call them 'books' and
> 'fruit'.
>
> They both have 'has_archive' set to true, and slugs of:
> /books/ and /fruit/
>
> In functions.php, I'm calling the following:
> if (is_archive('books')) {
> die("true");
> }
>
> Which returns true at:
> http://www.example.com/books/
> [expected behaviour]
>
> It *also* however returns true at:
> http://www.example.com/fruit/
> [unexpected behaviour when using the post_types parameter]
>
> This is using the latest version of WP.
>
> Am I missing something?
>
> For ref: http://codex.wordpress.org/**Function_Reference/is_archive<http://codex.wordpress.org/Function_Reference/is_archive>
>
> Thanks,
> Rob
> ______________________________**_________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.**com <wp-hackers at lists.automattic.com>
> http://lists.automattic.com/**mailman/listinfo/wp-hackers<http://lists.automattic.com/mailman/listinfo/wp-hackers>
>
More information about the wp-hackers
mailing list