Dynamic Menu Highlighting with different li classes
-
I have an image navigation menu, and am trying to make it so the hover class displays when the corresponding page is active. Site is karminmusic.com.
I have implemented the Method Two on this page but it didn’t solve the problem: https://codex.www.ads-software.com/Dynamic_Menu_Highlighting
Can anyone see what I’m doing wrong here? Pasting CSS and PHP below:
PHP:
<div id=”menu”>
-
<li<?php
if (is_page(‘Home’))
{
echo ” id=\”current.home\””;
}
?>><li<?php
if (is_page(‘See’))
{
echo ” id=\”current.see\””;
}
?>><li<?php
if (is_page(‘Follow’))
{
echo ” id=\”current.follow\””;
}
?>><li<?php
if (is_page(‘Store’))
{
echo ” id=\”current.store\””;
}
?>><!–<?php wp_list_pages(‘title_li=&depth=-1&sort_column=menu_order’); ?>–>
</div>
CSS:
#current.home {
background-image: url(“https://karminmusic.com/wordpress/wp-content/uploads/2010/03/home.png”);
background-repeat:no-repeat;
}
#current.see {
background-image: url(“https://karminmusic.com/wordpress/wp-content/uploads/2010/03/see.png”);
background-repeat:no-repeat;
}
#current.follow {
background-image: url(“https://karminmusic.com/wordpress/wp-content/uploads/2010/03/follow.png”);
background-repeat:no-repeat;
}
#current.store {
background-image: url(“https://karminmusic.com/wordpress/wp-content/uploads/2010/03/store.png”);
background-repeat:no-repeat;
}
- The topic ‘Dynamic Menu Highlighting with different li classes’ is closed to new replies.