Adding Facebook and LinkedIn icons on Mystique v2.x

Mystique theme for WordPress has reached version 2.0. Milenko is very active on updating it. With 2.0, you don’t need to edit any theme files manually, and this makes it much easier to add new social networking icons and replace the default Twitter and RSS icons. Here is how to do it:

First, download the image below (all icons were created by Mark Hewitt, I only merged the LinkedIn icon into the default icon set. You can find other icons on his site.), and upload it to your site. It will go to the SITE_ROOT/wp-content/uploads/ directory, if you did not change your upload destination.

OK, now that you have uploaded your image to your site, you will have to edit your site style. You will add the necessary changes to Mystique’s settings, so that they will not be overwritten after a theme update. Go to your admin panel and select Mystique settings under Appearance. In the settings page, select the User CSS tab, and add the following lines there:

/* Extra navigation icons */
#header a.nav-extra.rss{background:url("/wp-content/uploads/nav-icons.png") no-repeat scroll right top transparent}
#header a.twitter{background:url("/wp-content/uploads/nav-icons.png") no-repeat scroll -128px top transparent}
#header a.linkedin{background:url("/wp-content/uploads/nav-icons.png") no-repeat scroll -64px top transparent}
#header a.facebook{background:url("/wp-content/uploads/nav-icons.png") no-repeat scroll 0px top transparent}

The numbers after scroll in these lines select which icon to show. 0px is the first icon (i.e. Facebook), -64px is the second one (i.e. LinkedIn) etc. with decreasing 64 pixels.

If you want to lift the icons up a little bit, add the following lines before the lines you have just written:

#header p.nav-extra {top:-46px;height:54px;}
#header a.nav-extra {height:60px;}

You can change the height of the icons by changing the value of -46px in the first line.

Now that you have readied your icons, let’s show them on your site. Now select the Advanced tab from Mystique Settings, left to the User CSS tab that you are currently on. In the User functions section, add the following -and read the warning below a few times before adding it-. (do not remove the first line that says php there!)

WARNING! The following code is PHP code, that means, it will render your blog unusable if you don’t know PHP and try to change the contents of the code. Backup your WordPress database before adding this code.

function mystique_custom_nav_icons($nav_extra)
{
$nav_extra .= '<a href="YOUR_LINKEDIN_PROFILE" class="nav-extra linkedin" title="Contact me on LinkedIn!"><span>Contact me on LinkedIn!</span></a>';
$nav_extra .= '<a href="YOUR_FACEBOOK_PROFILE" class="nav-extra facebook" title="Contact me on Facebook!"><span>Contact me on Facebook!</span></a>';

return $nav_extra;
}

add_action('mystique_navigation_extra', 'mystique_custom_nav_icons');

If you want to remove Twitter icon and only want to show RSS, Facebook and LinkedIn icons, add this code instead of the one above:

function mystique_custom_nav_icons($nav_extra)
{
$nav_extra = '<a href="'.get_bloginfo('rss2_url').'" class="nav-extra rss" title="RSS Feeds"><span>RSS Feeds</span></a>';
$nav_extra .= '<a href="YOUR_LINKEDIN_PROFILE" class="nav-extra linkedin" title="Contact me on LinkedIn!"><span>Contact me on LinkedIn!</span></a>';
$nav_extra .= '<a href="YOUR_FACEBOOK_PROFILE" class="nav-extra facebook" title="Contact me on Facebook!"><span>Contact me on Facebook!</span></a>';

return $nav_extra;
}

add_action('mystique_navigation_extra', 'mystique_custom_nav_icons');

If you want to change the order of the icons, change the order of the lines in the example. Also, you can remove a line altogether if you don’t want to show an icon. For example the following code only shows RSS and Facebook icons with Facebook icon at the right and RSS icon at the left:

function mystique_custom_nav_icons($nav_extra)
{
$nav_extra = '<a href="YOUR_FACEBOOK_PROFILE" class="nav-extra facebook" title="Contact me on Facebook!"><span>Contact me on Facebook!</span></a>';
$nav_extra .= '<a href="'.get_bloginfo('rss2_url').'" class="nav-extra rss" title="RSS Feeds"><span>RSS Feeds</span></a>';

return $nav_extra;
}

add_action('mystique_navigation_extra', 'mystique_custom_nav_icons');

Change YOUR_LINKEDIN_PROFILE and YOUR_FACEBOOK_PROFILE according to your contact info. That’s all, now you should have the new icons on your site.

You may also like...

152 Responses

  1. Hello, i did everything just as you indicated, but i can’t add more icons except the two that already exist, [twitter and rss]. I can chenge the icon of these two as many times as i want, but i cannot add more icons. Im using individual icons for twitter and rss, qas for all the other that are not shown. I hope this is not a problem.
    I wil give to you the code that showd connect the icon with the corespondent site, this one is onlz for facebook:

    function mystique_custom_nav_icons($nav_extra)
    {
      $nav_extra .= 'Contact me on Facebook!';
     
      return $nav_extra;
    }
     
    add_action('mystique_navigation_extra', 'mystique_custom_nav_icons');
    

    Help me, please​.

  2. Umm, i guess, i don=t know how to integrate a code into a comment, eather. Here it is a capture that contains the code i used: http://img26.imageshack.us/img26/9126/capturebwr.jpg .

    Thank you.

  3. Never mind i got it right, i places the second block of code in the wrong sectiion. Thank you very much for this extremely helpful tutorial. Good day.

  4. Jordi says:

    Thanks for the tuto. I have a portal which frontpage is not wordpress, and its theme is custom and not mystique. Despite of this, I figured out how to add the icons into a div of a page (my test page is http://www.esquerrarubi.cat/index20100330.html ), but not the animation. I mean, if you hover over with the mouse, nothing happens.

    I would need to have this working, in the front page which is not wordpress.

    Do you know which part I am missing?

  5. Wow this is great just what i needed 🙂
    worked perfect for me thank you very mutch for this solution
    The results are visable at http://www.beeldenbewerk.nl

  6. JC says:

    Wow dude! This was awesome! Thanks for the help! It worked like a charm!

  7. Adam Cooper says:

    I can not thank you enough! This works perfectly and is exactly what I was looking for. Many thanks!

    • Kerem says:

      You’re welcome Adam. I checked out your site and being both an HDR and automobiles fan, it was like I was in heaven! Keep up the good work. 🙂

  8. RozaniGhani says:

    it doesnt work. i try it via localhost

  9. Tim says:

    Hey. I don’t want to add new icons, I’d just like to place an image to the left of the current Twitter and RSS icons. I don’t want it to link anywhere or have any hover effect. Is this possible?

    Cheers.

    • Kerem says:

      It’s probably possible, but I don’t know how to do it. Maybe someone can answer that on Mystique’s own comments section on Milenko’s site.

  10. Hi,
    Very nice web, I use this theme too and this tutorial helped me to put those icons on my blog.
    What plugin did you use for that “Share the knowledge” Sharer, I like it very much! I want that ^^
    I would apreciate some info!
    Bye!

  11. Shahid says:

    great i m also using this theme for my blog.. i want it to use in my own way.. my blog is similar to this one [removed for inappropriate content]

    eg: Mystique Settings>>Content>>Post Previews>> Content=”100 words/filtered”

    i have all posts with images and then text in them(and image is not uploaded onto my site its linked from another site and embed in html code eg: )

    is there anyway that image and text both shows when ‘100words/filtered’ is chosen.

    thanks in advance

    • Kerem says:

      You should set post previews to “full” in Mystique and use a plugin for previews. “Post Teaser” plugin can work for you.

  12. Steve says:

    Thanks, working on a new project and have decided to go with this theme. Looked around the net found a few articles and your made it a simple 2 minute process. Much thanks.

    -Steve

  13. Eyl says:

    Great theme!

  14. Fred says:

    Everything worked, except the image is not displayed. When I mouse over the navigation bar the title shows and the link works, but no image. My domain is not registered yet. Is that why the image does not display? My uploaded images are under (“/thevillageswebsites.com/wordpress/wp-content/uploads/FacebookIcon.png”) but as you can see, my temporary domain is listed above.

    • Kerem says:

      You have a configuration error and the browser tries to download (“/thevillageswebsites.com/wordpress/wp-content/uploads/2010/07/FacebookIcon.png”). After correcting that issue, it should work.

  15. Great tutorial.

    I don’t like to use /wp-content/uploads as folder. Instead, better use the default theme folder /mystique/images/

    Just a tip for not delete accidentally any image.

    • Kerem says:

      You can use any folder you want. But when using Mystique’s folder, you need to upload the image again after updating the theme. That’s why I suggest the uploads folder.

  16. Thanks!

    I trying to use but it doesn’t work. I know this is not a tutorial for CSS but, some things like a dot here ($nav_extra .=) and not there ($nav_extra =) or why it is called #header a.nav-extra.rss then a.twitter does not make sense or need more explanation.

    I don’t thing your code is wrong, but I miss some attention to details to personalize with generic examples.

    My USER CSS

    /* Extra navigation icons */
    #header p.nav-extra {top:-46px;height:54px;}
    #header a.nav-extra {height:60px;}  
    #header a.nav-extra.rss{background:url("/wp-content/themes/mystique/images/nav_icons/nav-rss.png") no-repeat scroll right top transparent}
    #header a.twitter{background:url("/wp-content/themes/mystique/images/nav_icons/nav-twitter.png") no-repeat scroll 192px top transparent}
    #header a.googlebuzz{background:url("/wp-content/themes/mystique/images/nav_icons/nav-googlebuzz.png") no-repeat scroll 128px top transparent}
    #header a.delicious{background:url("/wp-content/themes/mystique/images/nav_icons/nav-delicious.png") no-repeat scroll 64px top transparent}
    #header a.flickr{background:url("/wp-content/themes/mystique/images/nav_icons/nav-flickr.png") no-repeat scroll 0px top transparent}
    

    My function

    My Delicious Bookmarks!';
      $nav_extra .= 'My pictures on Flickr!';
      $nav_extra .= 'My Google Buzz!';
      $nav_extra .= 'RSS Feeds!';
      $nav_extra .= 'Follow me on Twitter!';
     
      return $nav_extra;
    }
     
    add_action('mystique_navigation_extra', 'mystique_custom_nav_icons');
    ​
  17. And I try both, positive and negative in the CSS values.

    • Kerem says:

      As a reply to your former two comments,

      First, you are using separate images, so you should use right top in your CSS for all icons like the one for the RSS icon. You could find this in the very first comment on this post as someone also had the same problem as yours. 🙂

      The other thing, it is a very fine line between writing a helpful tutorial and making it an information overload. First, the dot problem you mentioned is a PHP feature and to explain what it means I would have to start explaining PHP variables and how they are set and reset, so I did not want to go into that stuff. But basically, if you don’t put a dot before the equals sign, you reset a variable and if you put the dot, you append something to that variable. The second one, the difference in the names of icons is over me, it is the decision of Milenko who is the designer of Mystique, I am just a user like you who tries to find his way through CSS.

      Cheers.

    • Kerem says:

      Also, all images that you have set as icon images are getting “file not found” errors. That is, they do not exist in the location that you tell they are. You should first correct that error.

  1. April 12, 2010

    […] Kerem Erkan / Mark N Hewitt / C.M. Jackson .Net Descargas, Mystique, Temas, Tutoriales, […]

  2. April 14, 2010

    […] This post was mentioned on Twitter by Tsudo Shares. Tsudo Shares said: Bookmarked: Adding Facebook and LinkedIn icons on Mystique v2.x | Kerem Erkan: Tags: wordpress theme my… http://bit.ly/axzfb5 /via @diigo […]

  3. July 4, 2010

Leave a Reply

Your email address will not be published. Required fields are marked *