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

Bryan Harley bryanharley at gmail.com
Mon Aug 31 02:37:00 UTC 2009


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
>


More information about the wp-hackers mailing list