/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<div id="mainnav"> <ul id="mainnav"> <li<?php if (is_home()) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>">Home</a> </li> <li<?php if (is_page('about')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/about">About</a> </li> <li<?php if (is_page('lessons')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/lessons">Lesson Pricing</a> </li> <li<?php if (is_page('student-gallery')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/student-gallery">Student Gallery</a> </li> <li<?php if (is_page('blog')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/blog">Blog</a> </li> <li<?php if (is_page('contact')) { echo " id=\"current\""; }?>> <a href="<?php bloginfo('url') ?>/contact">Contact</a> </li> </ul></div>
URL: http://wordpress.org/support/topic/how-to-menu-highlight-current-page
Comments
