What's the simplest approach to highlighting the present page from the nav menu in Wordpress?

In case your top nav links are by hand placed inside your theme, that you can do something similar to this:

<a href="page-link" <?php if(is_page('page-name') : ?>class="highlight"<?php endif; ?> >Link text</a>

I actually do something such as this inside a theme where certain pages and groups have particular headers. You will find a couple of conditional functions which help with this particular:

  • is_page('page-name')
  • is_category('category-name')
  • is_home()
  • is_front_page()

Edit: Did not begin to see the comment about this being dynamic Wordpress links. You'll probably still have the ability to begin using these functions when the query data you receive back consists of the page slugs.

You may rather think about using the get_pages() function and loop through it by hand, doing an is_page() check up on each one of these to ascertain if the present page ID matches the ID from the page you're at within the array.

There's an article in the Wordpress Codex that ought to help you.

Current page highlighting sometimes is dependent on if it is implemented within the CSS from the theme you are using, but this will operate in a fundamental theme.

<?php wp_list_pages('title_li=&depth=1&'.$page_sort.'&'.$pages_to_exclude)?>

CSS: Alter the color within the CSS to whatever highlights well from the background from the menu bar or background image. Alter the # towards the container from the list pages call above.

#menu ul li a:active, #menu ul li.current_page_item a
{
color:#000;
}

You should use the dtabs plugin, which does exactly that, for pages, groups, home, and other kinds of pages.