Styling Navigation Background Colors (1.6+)

With the 1.6 version of WPFolio I added a drop down menu bar. The default hover and background styles are shades of grey. The background colors in the navigation menu can be changed using your child theme the code snippet below.

WPFolio version 1.6 includes a sample child theme for adding your own modifications. These modifications stay separate from WPFolio so you can update and keep your tweaks.

The code below should help you get started. Add a color value after “background:” and before the semicolon. You can use hex values (or rgba if you care to be so bold).

This entry was posted in News and tagged , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

15 Comments

  1. Nan
    Posted March 21, 2011 at 3:22 pm | Permalink

    I would be nice to tell people that the BACKGROUND COLORS for the Superfish menu is set in the option_stylesheet.php so they don’t spend hours of tweaking and headbanging trying to figure out why the above instructions have ABSOLUTELY NO EFFECT WHATSOEVER.

    /rant.

    • Posted March 21, 2011 at 7:15 pm | Permalink

      If you put your changes in the childtheme, they should work. Can you confirm that you were using the childtheme, had it activated, and had your changes in the style.css of that child theme?

  2. Posted May 3, 2011 at 5:09 am | Permalink

    hey, how can you change the width of the drop down menus so that it is as wide as the longest menu item? My text is running off the edge and can’t see anything in styles.css that allows for adjustment.

    • Posted May 5, 2011 at 7:41 pm | Permalink

      Post on the wordpress forums. And what’s used is called a “superfish menu”

  3. narnix
    Posted May 19, 2011 at 2:31 am | Permalink

    How do I change the font and background color of the main navigation menu? right now the default is grey, and with a grey box when rolled over, I would like it to be black (with no grey box) when rolled over.
    I tried using the code posted here but it didn’t work, where it is suppose to be inserted in the child theme: function.php? style.css?

  4. Posted June 15, 2011 at 7:45 pm | Permalink

    First off, thank you guys for this amazing theme; it’s helped me make my very first website look amazing!

    I can confirm that the code posted in the post doesn’t work for me; I only get a single bit of difference when I change the second ‘background’ colour, and that changes the colour of the box when it’s highlighted. Changing the other background values does nothing.

    Any advice?

    • Posted June 15, 2011 at 8:14 pm | Permalink

      Ah, you are right! This should fix it and will be included in the next release of WPFolio.

      In header.php find these 2 lines at line #38:

      <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" />
      <link href="<?php echo home_url();?>/?wp_folio_css=css" rel="stylesheet" type="text/css" />

      and reverse them like so:

      <link href="<?php echo home_url();?>/?wp_folio_css=css" rel="stylesheet" type="text/css" />
      <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" />

      This makes your childtheme stylesheet trump the theme options stylesheet.

      • Posted June 16, 2011 at 7:50 am | Permalink

        Thanks for the quick reply Steve!

        I put that code into the header.php like you suggested, but now, it seems like the ‘Theme Options’ that you can alter within WordPress don’t work anymore; the page container colour has gone, the blog title appears, the fonts aren’t the ones I selected etc.

        I then replaced it with with the first 2 lines of code in your reply, expecting it to return to normal, and it all still looks broken! What have I done wrong?

        • Posted June 16, 2011 at 8:04 am | Permalink

          Sorry for the double post, but I figured out what was wrong with the code when I tried to go back to the original style; there’s an extra ‘href=’ in the second line. Getting rid of that returns things to normal!

          So, the only problem now is that the new piece of code stops the use of the ‘Theme Options’. Do I now need to set the options within the child style sheet?

          • Posted June 16, 2011 at 10:07 am | Permalink

            Oh sorry, the comments form stripped the code so then I had to fix some stuff by hand. I committed the change so you can verify it on line 38 of the code.

            All that change should do is place priority on the childtheme stylesheet. Your theme options should still work, but the childtheme will always override them. There’s a chance that link came out wrong too, so double check the code.

            I tested this myself and it worked for me. Sorry you’re sort of a guinea pig on this, but if you could test it further it would help. Make sure that code is right, verify you’re not overriding in the stylesheet what you want to change in the theme options, and try again and let me know.

  5. Posted June 16, 2011 at 10:18 am | Permalink

    Right! Progress!

    The code works, up to a point. Changing the background values for the menu now works, EXCEPT for the first one. I assume the 2nd background colour denotes what colour the menu will be when highlighted, and the 3rd background colour denote what colour the menu will be when it is not highlighted.

    However, because the first background colour doesn’t change anything, I’m not sure what it’s supposed to do; change the actual background colour of the menu ‘tabs’ themselves?

    Also, the menu itself has an odd outline (exact same colour as my background) on the left and the top of each selection. Any way to change this?

    Thanks Steve! Keep up the good work!

    • Posted June 16, 2011 at 10:39 am | Permalink

      Ah, again, sorry for the double post!

      The first background colour DOES change something; if you go to a page/post straight from the main menu, and not through sub-menus, the menu item will be highlighted, and this dictates what colour that will be.

      • Posted June 16, 2011 at 10:44 am | Permalink

        that’s the “active” page in the menu. So if you are on the “about” page, then “about” will be highlighted in the menu.

    • Posted June 16, 2011 at 10:40 am | Permalink

      The code above is meant to be a starting point (I’ll edit the post and mention that). So by all means, modify it to suit your purposes. The outline you mention is just a border, which you can also add css to change or remove. Looks like you’re on your way!

Post a Comment

Woah woah woah! Thinking about leaving a comment? If it starts anything like "How do you…" or "I can't figure out..." then head over to the WPFolio Support Article and read through it. Posting on WordPress Support is usually a better idea.

If you're going to post a comment, consider making a donation at the same time.

Your email is never published nor shared.

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

Are you signed up for     WPFolio email updates? »