views:

28

answers:

1

Currently the navigation menu (consisting of a list of posts) that appears on the front page of my wordpress site has the most recent post highlighted in it. However I don't want this. Is there a way I can change it so that on the front page the navigation doesn't have an on-state, but on all other post pages it does? Below is the code that I think it generating it.

<li<?php echo((!is_front_page() AND $post->ID == $wp_query->post->ID) ? ' class="selected"' : ''); ?>>
                                <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
                            </li>
A: 

Get rid of the php inside the <li> element tag. Without a link to the website, I can't say for sure, but I think that's what's doing it. Anyway, $post->ID == $wp_query->post->ID will almost always return true, since $post is $wp_query->post. Custom loops can change this, but I'm pretty sure nav menus don't override the global $post variable.

John P Bloch
So do you mean remove the whole string: "<?php echo((!is_front_page() AND "?
Glyphism
I just tried removing the whole php tag inside the <li> and that did not work. it disabled the menu highlighting across all pages, not just the front page.
Glyphism