• I am trying to code the main menu for my site https://johnhobsonphotography.co.uk/ so that the button changes when a particular section is active.

    I have it working fine for the home and about pages but the blog page highlights the photographs page, which is a link to the wp-gallery2.php. When the photographs page is active the home page is highlighted. The photographs page uses the wordpress gallery 2 plugin.

    I have been playing around with this for ages now and am now at a loss as what to try next, could anyone help me please?

    The code for the main menu currently looks like this:


    <?php /* If this is the frontpage */ if ( is_page('home') ) { ?>
    <li class="on"><a href="/">Home</a><?php } else { ?>
    <li><a href="/">Home</a></li>
    <?php } ?>
    <?php /* If this is the photos page */ if ( !is_page() ) { ?>
    <li class="on"><a href="/wp-gallery2.php">Photographs</a><?php } else { ?>
    <li><a href="/wp-gallery2.php">Photographs</a></li>
    <?php } ?>
    <?php /* If this is the blog */ if ( is_page('Blog') ) { ?>
    <li class="on"><a href="/blog/" title="Blog">Blog</a><?php } else { ?>
    <li><a href="/blog/" title="Blog">Blog</a></li>
    <?php } ?>
    <?php /* If this is the about page */ if ( is_page('About') ) { ?>
    <li class="on"><a href="/about/" title="About">About</a><?php } else { ?>
    <li><a href="/about/" title="About">About</a></li>
    <?php } ?>

  • The topic ‘Site menu help’ is closed to new replies.