That looks promising! I knew there must be a better way, especially since WP is evolving to manage entire sites, not just a blog section.
Thanks so much... this list rules! Rob On Sep 22, 4:09 pm, Paul <[email protected]> wrote: > Rob, > > My preference is to use the new WordPress 'body_class()' function. > This is added to your theme's HTML Body tag like: > > <body <?php body_class(); ?>> > > (Not sure how well the PHP code will come through. Check the > header.php in the default theme which comes with WP) > > The 'body_class()' will basically apply CSS class values to your body. > So now you just need to setup class values on your navigation items. > This will work out better then attempting to identify the page in your > LI element with WP PHP functions. > > so you will need to setup some CSS rules for highlighting the > appropriate nav item > > // This assumes you replace the PHP code in your first (Home) LI item > to a class like 'class="home" ' > body.home ul.nav li.home a {...} > > For a real working example check outhttp://spark.highwirecreative.com/ > I just worked on some of the development last week. Doing just what > you are attempting. The 'Blog' section works just like what you are > attempting. > > Paul > > On Sep 22, 2009, at 3:57 PM, [email protected] wrote: > > > > > Ok, need a wordpress guru ... this will be easy for ya but its > > > I have a nav menu that I want to highlight based on what page/category > > the user is in: > > > <ul><!-- main navigation --> > > <li <?php if(is_home()): ?>class="current_page_item"<?php endif; ?>><a > > title="Home page" href="<?php bloginfo('url'); ?>"><span>Home</span></ > > a></li> > > > <li <?php if(is_category('Portfolio')): ?> class="current_page_item"<? > > php endif; ?> ><a href="/category/portfolio">Portfolio</a></li> > > > <li <?php if(is_page('Services')): ?>class="current_page_item"<?php > > endif; ?> ><a href="/services/">Services</a></li> > > > <li <?php if(is_category('blog') ): ?>class="current_page_item"<?php > > endif; ?> ><a href="/category/blog/">Blog</a> </li> > > > </ul> > > > This works great.... EXCEPT when you go into an individual blog entry. > > Then no workie. I tried this: > > > <li <?php if(in_category('blog') .... > > > but that became true for Home and Services "pages" as well. So finally > > I came up with: > > > <?php if(in_category('blog')&&(!is_page())&&(!is_home()) ) > > > and that worked... but that is lame? Is there a better way? I just > > want to understand this stuff with resorting to hackery :p > > > Thanks > > > Rob --~--~---------~--~----~------------~-------~--~----~ Our Web site: http://www.RefreshAustin.org/ You received this message because you are subscribed to the Google Groups "Refresh Austin" group. [ Posting ] To post to this group, send email to [email protected] Job-related postings should follow http://tr.im/refreshaustinjobspolicy We do not accept job posts from recruiters. [ Unsubscribe ] To unsubscribe from this group, send email to [email protected] [ More Info ] For more options, visit this group at http://groups.google.com/group/Refresh-Austin -~----------~----~----~----~------~----~------~--~---
