[wp-hackers] Can't use the same conditional tag twice?

Dion Hulse (dd32) wordpress at dd32.id.au
Mon Aug 31 08:13:58 UTC 2009


are you using query_posts()?

query_posts overrides the current query, Its not the best way to go about  
what most people use it for.

try adding wp_reset_query() iin your footer and see if that helps (for  
future reference) - Or call it after query_posts is finished.

On Mon, 31 Aug 2009 12:37:00 +1000, Bryan Harley <bryanharley at gmail.com>  
wrote:

> Peter/Jeremy,
>
> I'm using the following code in both my header and footer.
>
> <li class="<?php if ( is_home() ) { echo 'current_page_item'; } ?>"><a
> href="URLHERE">Welcome</a></li>
>
> Here's the CSS:
>
> li.current_page_item a{border-bottom: 3px solid #ec1c24;}
>
> But the border is only showing in the header, not the footer.  To
> correct this, I left my header code the same and changed the footer
> code to:
>
> <li class="<?php if ( is_front_page() ) { echo 'current_page_item'; }
> ?>"><a href="URLHERE">Welcome</a></li>
>
> That solved the problem, but I don't understand why it just didn't
> WORK in the first place.  Which lead me to believe maybe you can only
> use one conditional tag per page.
>
> -Bryan
>
>
> On Thu, Aug 27, 2009 at 10:58 AM, Jeremy Clarke<jer at simianuprising.com>  
> wrote:
>> On Wed, Aug 26, 2009 at 9:10 PM, Bryan Harley<bryanharley at gmail.com>  
>> wrote:
>>> It seems to me that you can't use the same conditional tag on the same
>>> page twice.  Can anyone else confirm this.  Why is this so?
>>
>> In my experience this is definitely not the case. You probably have
>> some kind of other issue with your template. Conditional tags would be
>> practically useless if they were limited to once per page.
>>
>>
>> --
>> Jeremy Clarke | http://jeremyclarke.org
>> Code and Design | http://globalvoicesonline.org
>> _______________________________________________
>> 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
>


-- 
--
Dion Hulse
e: contact at dd32.id.au
w: http://dd32.id.au/
m: 04 6621 9112 (+614 6621 9112)
WordPressQI: http://wordpressqi.com/


More information about the wp-hackers mailing list