• Resolved Phoenix39

    (@phoenix39)


    I’m finding the code examples a little confusing, so could anyone help me with adding my own css style to this menu?

    <div id="mainmenu">
    		<?php wp_nav_menu( array( 'theme_location' => 'mainmenu' ) ); ?>
    </div>

    What should I add to the php code, and where does it end up in my style.css?

    Help much appreciated.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You should be able to use the existing CSS to modify the styles – but you need to use a Child Theme or custom CSS option (if your theme has it) or custom CSS plugin.

    What theme are you using?

    Are you using a browser tool like Firebug to work with the CSS?

    Thread Starter Phoenix39

    (@phoenix39)

    I’ve made my own design from scratch, so most of the wordpress stuff is gone. My css file only contains the stuff I use (a pretty simple html design).

    Is there an easy way to add a piece of code to the php menu thing, so it can be styled in my style.css?

    Thread Starter Phoenix39

    (@phoenix39)

    Yes, but with my very limited php knowledge it doesn’t help a lot.

    I’ve finally been able to add ‘menu_class’ into the php code, so I was able to edit the ul part of the css. I still don’t know how to edit the li class and link stuff though (like changing link colors)… how do I do that?

    Start learning CSS, and use a browser tool like Firebug –

    https://www.w3schools.com/css/default.asp

    https://getfirebug.com

    Beyond that, there’s no way for anyone to help with CSS without seeing the site live.

    Thread Starter Phoenix39

    (@phoenix39)

    I don’t think you get my problem.

    I know CSS and HTML. It’s php I’m having problems with. So – my menu is just a php code, that’s why I find it hard to manage. I just need to know what to add into my php code to be able to edit the css parts.

    for example, by adding ‘menu_class’ to my menu code I was easily able to edit the ul part of the css (while other parts like li and links were not possible to change).

    So if anyone has some specific help regarding defining style in my php menu, I would really appreciate it!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What specifically do you want to style that you cannot with the current HTML structure?

    You should be able to use the menu CSS selectors to target the li and link elements without changing any php. For example, something like –

    .my-menu ul li a {
       styles;
    }

    will style the link.

    Thread Starter Phoenix39

    (@phoenix39)

    Just what I was looking for! Perfect! Thanks a lot.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Style navigation menu?’ is closed to new replies.