Here is a quick snippet of a non-elegant way to create a navigation for a wordpress template. This sample includes links to specific pages using get_permalink() and is_page(), along with get_category_link() and in_category(). Using these functions you can determine if each link should be in its active state or not.
$links = array( 'Industry Studies' => array(get_permalink(12), is_page(12)), 'Recipes' => array(get_category_link(3), ($categoryId ? 3 == $categoryId : in_category(3))), 'Blog' => array(get_category_link(1), ($categoryId ? 1 == $categoryId : (in_category(1) && !is_page()))), ); $selected = false; foreach ($links as $title => $link): $linkSelected = (!$selected && $link[1]) ? ($selected = true) : false; printf('<li><a href="%s" class="%s" title="%s">%s</a></li>', $link[0], ($linkSelected ? 'selected' : ''), $title, $title); endforeach; |

