WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Inserting Facebook button in Nav Menu (9 posts)

  1. hiphopinenglish
    Member
    Posted 2 years ago #

    Hi all.

    Using a Child Theme of Twentyeleven, I'm experiencing a few issues getting my Facebook "Button" (Menu Item) showing in my nav menu. I've created the basic CSS but as I'm not very good at CSS, I've messed up!

    #access .facebook {
        float: right;
        }
        #access .facebook a {
        background: transparent url ('/uploads/2012/06/FB-Logo-Final.png') 0 0 no-repeat;
        padding: 0;
        text-indent: -9999px;
        width: 42px;
        }
        #access .facebook a { background-position: 0 -96px; }
        #access .facebook a:hover, #access .facebook a:focus, #access .facebook a:active {
        background: transparent url(uploads/2012/06/FB-Logo-Final.png) 0 0 no-repeat;
        }

    That's the CSS I've used, and in conjunction with that I've created the Custom Menu calling the .facebook access in the CSS Classes box when creating the Menu.

    Now, the problem is it's worked! But not exactly. The button exists but doesn't show my uploaded .png button I made. (Incidentally it's 42x42px if that makes any difference). So much so, that the item is clickable if you know it's there.

    The page in question is and the Button is just left of the menu.

    Can someone please shed light on what's gone wrong? I've checked the URL of my image is correct. Perhaps I've not called it correctly in CSS? Any help of course appreciated. Thanks.

  2. brazley
    Member
    Posted 2 years ago #

    do you have a link to the site?

  3. Digital Raindrops
    Member
    Posted 2 years ago #

    Add the images in the child themes folder, create a new sub folder images, This post might help!

    background: url('images/facebook.png');
    background-repeat: no-repeat;

    for IE7 send the tag off the page!

    #access .facebook a{
       color: transparent !important;
       padding: 0;
       left: -9999;
    }

    David

  4. hiphopinenglish
    Member
    Posted 2 years ago #

    do you have a link to the site?

    Of course. Sorry I forgot to submit that before! Duh!
    Here's the link: http://hiphopinenglish.com

    @David. I'll check your tips in an hour or two (when I can), and I'll get back to you. Cheers for your help anyway!

  5. hiphopinenglish
    Member
    Posted 2 years ago #

    Hi to both.

    I've read the post you linked to David. It helped, so I've now modified my CSS to something similar to what you'd posted there. Here is an exact copy of what I have:

    #access .facebook {
    width: 42px;
    text-align: center;
    float: right;
    }
    .facebook,
    #access .facebook:hover >a,
    #access .facebook a:focus
    {
    background: url('Images/FB-Logo-Final.png');
    background-repeat: no-repeat;
    padding: 0;
    }
    .facebook a
    {
    color: transparent !important;
    padding: 0;
    left: -9999;
    }

    I've simplified my image location too, as per your suggestion, creating a folder called Images inside my Child Theme, and placing the .png image inside. Still the same, no result. I can click the button (it exists!) but the image won't show. Any ideas? Testing in Firefox.
    Link to site in case you missed it is: http://hiphopinenglish.com

    Lastly, I didn't quite understand what you were saying about IE7. Could you clear that up for me, please?
    Thanks in advance.

  6. Digital Raindrops
    Member
    Posted 2 years ago #

    The image is failing to load, it is case sensitive, try and keep the image names and folders all lowercase, so the folder /images/ and the image facebook.png

    Then this should work:

    background: url('images/facebook.png');

    The IE7 part was just that the <a> tag would not render right in IE7.
    You had already coved this off with this line:

    text-indent: -9999px;

    So ignore the IE part.

    HTH

    David

  7. hiphopinenglish
    Member
    Posted 2 years ago #

    I've followed your instructions as best as possible David, but no joy.

    Created folder called images (lowercase, yes) inside child theme. File is named fblogofinal - all lower case. No joy.

    Code is:

    #access .facebook {
    width: 42px;
    text-align: center;
    float: right;
    }
    .facebook,
    #access .facebook:hover >a,
    #access .facebook a:focus
    {
    background: url('images/fblogofinal.png');
    background-repeat: no-repeat;
    padding: 0;
    }
    .facebook a
    {
    color: transparent !important;
    padding: 0;
    left: -9999;
    }

    Seems ok to me, debugging in Firebug shows some weirdness though. Not quite sure what, but not sure it's calling the image right still. Any ideas? (Lastly, I renamed the menu FB as the Navigation Class as I read on DR that the name being too long could be an issue.)

    Help!

  8. Digital Raindrops
    Member
    Posted 2 years ago #

    Just checked in Firebug and the class is facebook and it is looking for and failing to load the image url.

    "images/facebook.png"

    With testing the url it will load!

    The image path is relative to the stylesheet, so that brings us to look at the stylesheet, with FireBug, and all that is in the child themes style.css after the comments is:

    @import "../twentyeleven/style.css";
    .entry-meta {
        display: none;
    }

    The changes are currently being loaded in the header by a plugin, where are you adding them, in the plugins custom.css text area?

    <!-- fonts delivered by WordPress Google Fonts,
    a plugin by Adrian3.com -->

    All your style changes should be in the child themes style.css and not injected into the <head></head> by a plugin, if you just move the custom styles to the child themes style.css, then the problem should be solved!

    HTH

    David

  9. hiphopinenglish
    Member
    Posted 2 years ago #

    Lovely David. That solved it. To anyone else working on this issue, or a similar one, it seems that if you're calling an image (or similar) in CSS, you'll need to add it into your Child Theme's style.css directly, NOT into the TwentyEleven Theme Extensions plugin Custom CSS area.

    Resolved. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic