• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

WordPress adds CSS to custom menu items?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › WordPress adds CSS to custom menu items?

This topic is: resolved

Tagged: classes, social icons

  • This topic has 37 replies, 5 voices, and was last updated 13 years, 7 months ago by susanlangenes.
Viewing 20 posts - 1 through 20 (of 38 total)
1 2 →
  • Author
    Posts
  • January 28, 2013 at 7:04 pm #15833
    daniel123
    Member

    I found this guide showing me how to add social media icons to the navigation menu. You create the css selectors in the style.css file and make the background your social image (like facebook).

    The problem is, if I specify a class such as .twitter-menu, it WILL add it to the twitter menu item, however it adds all these other classes which I don't want.

    So how do I go about removing these unnecessary classes? Right now the "twitter"  icon appears as a page, which I DON'T want.

    Thanks, blog: http://UberBlogging.com

    January 28, 2013 at 7:10 pm #15837
    SoZo
    Member

    You override any styles you don't want by adding them to the .twitter-menu rule


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 28, 2013 at 7:14 pm #15839
    daniel123
    Member

    I'm confused by that. Can you give an example? Thanks.

    January 28, 2013 at 7:18 pm #15842
    SoZo
    Member

    What do you want to override?


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 28, 2013 at 7:59 pm #15852
    daniel123
    Member

    This is the CSS for the twitter icon I want to add as a link

    .menu-twitter {
    text-indent: -9999px;
    background-image: url(wp-content/uploads/2013/01/social_twitter_box_blue_128-e1359321126789.png) !important;
    background-repeat: no-repeat !important;
    margin-left: 70px !important;
    width: 30px;
    }

     

    Then I added the CSS Class menu-twitter to the link. It doesn't work, the attribute I want is menu-twitter but it adds the following to it - menu-twitter menu-item menu-item-type-custom menu-item-object-custom menu-item-189 . Why does it do this?

     

     

    January 28, 2013 at 8:09 pm #15855
    SoZo
    Member

    The selector needs to be .menu li.menu-twitter a


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 28, 2013 at 8:17 pm #15857
    daniel123
    Member

    I updated the css to that

    .menu li.menu-twitter a {
    text-indent: -9999px;
    background-image: url(wp-content/uploads/2013/01/social_twitter_box_blue_128-e1359321126789.png) !important;
    background-repeat: no-repeat !important;
    margin-left: 70px !important;
    width: 30px;
    }

    It doesn't seem to work though.

    January 28, 2013 at 8:57 pm #15864
    SoZo
    Member

    I'm not seeing that selector anywhere in your active style sheet


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 28, 2013 at 9:38 pm #15877
    daniel123
    Member

    Can you see it there now? If not, what am I doing wrong?

    January 28, 2013 at 10:25 pm #15889
    SoZo
    Member

    No, there is no instance of "li.menu-twitter a" in your style sheet. Make sure you are editing the correct one.

    You're style sheet actually looks pretty messed up. You've got a php function in there at the bottom "add_theme_support( 'post-thumbnails' );"

    I suggest reinstalling the style sheet


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 30, 2013 at 7:49 pm #16611
    daniel123
    Member

    My CSS is now cleaned up. I found out the issue with the li.meu-twitter a not showing up had to do with cloudflare so I disabled it for the time being.

    So for now, I added 2 icons, twitter and facebook but have some issues with them. I need them both to be lower in the menu and now hover effects.

    Thanks for the help.

    January 30, 2013 at 8:00 pm #16613
    daniel123
    Member

    Sorry I meant no* hover effects

    January 30, 2013 at 8:08 pm #16616
    SoZo
    Member

    I get a 404 when visiting your site now

    404. That’s an error.

    The requested URL / was not found on this server. That’s all we know.


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 30, 2013 at 8:10 pm #16617
    daniel123
    Member

    Did you clear your cache? Working fine with different browsers and devices here.

    January 30, 2013 at 8:12 pm #16620
    SoZo
    Member

    Yes, I cleared my cache.

    We're still talking about http://uberblogging.com/ correct?


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 30, 2013 at 8:17 pm #16624
    daniel123
    Member

    Yes we are. I just tried a proxy and it still works perfectly. Not sure what's wrong..

    January 30, 2013 at 8:26 pm #16628
    SoZo
    Member

    Ok, it's back now.

    You need to define a hover rule and you can push them down with top margin.

    Wait, now I'm getting a 404 again.


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 30, 2013 at 8:51 pm #16642
    daniel123
    Member

    I googled and couldn't find anything on a hover rule, could you give me an example?

    Is it not working at all for you now?

    January 30, 2013 at 9:02 pm #16647
    SoZo
    Member

    Hover is a pseudo class. You need to add a new rule for the hover state, e.g. .menu li.menu-twitter a:hover that overrides any of the properties from the default hover .menu-primary li a:hover that you don't want. If you want both social items to have the same hover effect then you can group your selectors, e.g.

    .menu li.menu-twitter a:hover,
    .menu li.menu-facebook a:hover {
    padding: 10px;
    }

    And it seems to load if I stay away for awhile but if I refresh then I get a 404. It loaded the site when I checked just now to get the rule you are using but I refreshed and now get a 404.


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    February 2, 2013 at 10:15 am #17360
    daniel123
    Member

    Ok, I do not know how to fix this though. when hovering over it moves, how do I prevent this? I am confused. I'm pretty familiar with CSS just not sure about this.. Thanks.

  • Author
    Posts
Viewing 20 posts - 1 through 20 (of 38 total)
1 2 →
  • The topic ‘WordPress adds CSS to custom menu items?’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble