[wp-hackers] Fix for is_home() in combination with custom post type?

Philip M. Hofer (Frumph) philip at frumph.net
Tue Nov 9 16:12:41 UTC 2010


query_posts is doing it

You should use a different method for what your trying to accomplish, as in 
the loop that uses the query,  me?  I use some custom functions I wrote that 
protect() and unprotect() the main wp_query while doing any other loops 
within sections, i.e. custom post type sections

http://wp.pastebin.com/hesq0Ez3

That way as soon as the loop is over it resets it back to the default 
wp_query and post data

----- Original Message ----- 
From: "Bjorn Wijers" <burobjorn at gmail.com>
To: <wp-hackers at lists.automattic.com>
Sent: Tuesday, November 09, 2010 7:53 AM
Subject: [wp-hackers] Fix for is_home() in combination with custom post 
type?


> Hi,
>
> It seems I'm experiencing a known problem[1] with is_home reporting true 
> on custom post index pages. I thought to have found a solution in 
> somadesign.ca's class[2], but that does not seem to work.
>
> I'm referring to using the template_redirect hook to set is_home to false 
> on my custom posts index page. This does set is_home to false and then it 
> is being set to true again.
>
> I'm using this function which is almost a complete copy of Somadesign.ca's 
> class (thanks!): https://gist.github.com/669261
>
> What am I doing wrong? What can I do to fix is_home()? Do I need to use a 
> different hook? Hints and tips most appreciated!
>
> [1] 
> http://groups.google.com/group/wp-hackers/browse_thread/thread/49f5355cd613f58a
> [2] http://somadesign.ca/projects/smarter-custom-post-types/
>
> Thanks in advance!
>
> -- 
>
> met vriendelijke groet,
> Bjorn Wijers
>
> * b u r o b j o r n .nl *
> digitaal vakmanschap | digital craftsmanship
>
> Werkdagen:
> Van maandag t/m donderdag vanaf 10:00
> Vrijdag is voor experimenteren en eigen projecten.
>
> Concordiastraat 68-126
> 3551 EM Utrecht
> The Netherlands
>
> tel: +31 6 49 74 78 70
> http://www.burobjorn.nl
> _______________________________________________
> 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