[wp-hackers] Is this a bug? - is_archive()

Gavin Pearce Gavin.Pearce at 3seven9.com
Mon Oct 17 16:10:56 UTC 2011


Thanks :)

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Bill
Erickson
Sent: 17 October 2011 16:35
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Is this a bug? - is_archive()

I just updated that codex page.


---
Bill Erickson
WordPress Consultant
http://www.billerickson.net


On Mon, Oct 17, 2011 at 10:21 AM, Gavin Pearce
<Gavin.Pearce at 3seven9.com>wrote:

> Good spot - I've cross posted to the 'docs' page to ask someone to
> update the codex for that page.
>
> It does incorrectly list post type as a parameter.
>
> G
>
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com
> [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Bill
> Erickson
> Sent: 17 October 2011 16:17
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] Is this a bug? - is_archive()
>
> 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.a
> utomattic.com/mailman/listinfo/wp-hackers>
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list