/ Published in: PHP
An example of how to write your own navigation with dynamic "active" classes.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function custom_nav_menu() { ?> <ul id="tabs"> <li<?php if (is_home()) echo(' class="current_page_item"'); ?>><a href="<?php bloginfo('url'); ?>" rel="nofollow">home</a></li> <li<?php if (is_page('about-me')) echo(' class="current_page_item"'); ?>><a href="<?php bloginfo('url'); ?>/about/"<?php if (!is_home()) echo ' rel="nofollow"'; ?>>about</a></li> <li<?php if (is_page('contact-me')) echo(' class="current_page_item"'); ?>><a href="<?php bloginfo('url'); ?>/contact/"<?php if (!is_home()) echo ' rel="nofollow"'; ?>>contact</a></li> <?php if (thesis_get_option('show_feed_link')) { $feed_title = get_bloginfo('name') . ' RSS Feed'; echo ' <li class="rss"><a href="' . thesis_feed_url() . '" title="' . $feed_title . '" rel="nofollow">' . thesis_feed_link_text() . '</a></li>' . "\n"; } ?> </ul> <?php } remove_action('thesis_hook_before_header', 'thesis_nav_menu'); add_action('thesis_hook_before_header', 'custom_nav_menu');