Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Designsolutions,

    I saw there is a problem in the source code of your page…
    You should have the CSS class “current-menu-item” on the “li” element for the displayed menu item. But it’s not the case.
    I don’t know how to do this. Sorry.

    Thread Starter DesignSolutions.pl

    (@designsolutions)

    Thanks riversatile for your reply. I tryed a lot of solutions to resolve it but nothing works. I tryed also with “current-menu-item” and it not works. Maybe I make something wrong or there is some harder problem in WordPress I think…

    When I put “current-menu-item” in the Class of your current menu “li” element, the menu is highlighted correctly !
    The inner “a” element CSS style is : background: #d64387;

    See the demo here: https://postimg.org/image/j3gncf193/

    So the only thing to solve is to know why the Class “current-menu-item” doesn’t show up.

    Thread Starter DesignSolutions.pl

    (@designsolutions)

    Yes, you`ve got true. But how to change class for li? Navigation is put in php as:

    <div class=”navigation”>

      <?php wp_nav_menu(array(‘menu’ => ‘il’)); ?>

    </div>

    Can I set here class current-menu-item or something?

    Yes, you have to add something in the PHP code.
    Here is what I found on THIS TOPIC. It may help.

    If you’re using PHP you could use a variable to indicate wheter the page is active.

    <div id="main-menu">
                <ul div="nav">
                    <li><a <?php echo $isactive; ?> href="about.html" target="_blank">ABOUT</a></li>
                    <li><a <?php echo $isactive; ?> href="services.html" target="_blank">SERVICES</a></li>
                    <li><a <?php echo $isactive; ?> href="portfolio.html" target="_blank">PORTFOLIO</a></li>
                    <li><a <?php echo $isactive; ?> href="blog.html" target="_blank">BLOG</a></li>
                    <li><a <?php echo $isactive; ?> href="contact.html" target="_blank">CONTACT</a></li>
                </ul>
    Then if the page is active you could print something like "class='active_section'" and in your css:
    
    .active_section {
    color: #CE1F20;
    text-decoration: none;
    }

    You just have to adapt the Class in function of your Class name (“current-menu-item”)

    Thread Starter DesignSolutions.pl

    (@designsolutions)

    Thanks for your reply ??
    I tryed it and also doesnt work. Im out of my mind with this case ;/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem with menu .active’ is closed to new replies.