• Skip to main content

Victor Font Consulting Group, LLC

Digital Business Strategists

Call Us:

+1 919-604-5828

  • Home
  • Care Plans
    • Care Articles
    • Optional Subscriptions
  • Consultations
  • Products
    • Code Snippets
    • Public GitHub Repositories
    • Gist Snippets
    • Pastebin Snippets (Free)
    • Free Plugins
  • FAQs
  • Support
    • Graphic Design
  • Contact
    • Speakers
    • Portfolio
  • Resources
    • Free WordPress Video Training
    • Tutorials
    • Articles
    • Cybersecurity
    • EU Referral Network
You are here: Home / Code Snippet / Social Media Icons in WordPress Menus

Social Media Icons in WordPress Menus

By Victor M. Font Jr.
February 11, 20161 Comment

Add Social Media Icons to Navigation Menu, public domain image courtesy of pixabay.com
Contents
  • Social Media Icons & Font Awesome
  • Create a Custom Menu Item
  • The CSS
  • The Result

A recently asked question on the Studio Press forum was:

How do I add social media icons to the main navigation menu?

While there are a number of ways to do this by adding code to a theme's functions.php file, the method described in this article may prove to be just a little bit easier for the non-coder. It uses the popular Font Awesome iconic font and CSS toolkit, a little bit of CSS, and a few custom menu items.

Social Media Icons & Font Awesome

As a CSS Toolkit, Font Awesome gives you 605 scalable vector icons in one font that can easily be customized—i.e., size, color, drop shadow, or anything that can be done to text with the power of CSS. For a WordPress powered site, setting up Font Awesome can be as simple as adding one line of code to your theme's functions.php file. On this website Font Awesome is installed with the following line of code:

The only drawback to this method is that when there is a new Font Awesome release, you have to manually update your functions.php file to change the version number. An easier method for installing Font Awesome on your site is to install the Better Font Awesome plugin, which allows you to automatically integrate the latest available version of Font Awesome into your WordPress project, along with accompanying CSS, shortcodes, and TinyMCE icon shortcode generator. Using this plugin, your Font Awesome installation will always remain up to date.

If you don't know how to install a plugin in WordPress, please register for our free WordPress Video Training and watch Part 20—Plugins.

Create a Custom Menu Item

Now that you have Font Awesome installed. Let's create a custom menu item. Navigate to the Appearance/Menus page and select your primary navigation menu. From your selections on the left, choose Custom Links, fill in the values for URL and Link Text, and then click the Add to Menu button.

Once the custom link is added to the menu, edit it so it appears similar to the image below.

Custom Social Media Icon Menu Item

Custom Menu Item Content

Add your custom values to make the custom link appear similar to the image on the left, which demonstrates adding a Facebook icon.

  • URL: Link to your social media page
  • Navigation Label: <i class="fa fa-facebook"></i><span class="fa-hidden">Facebook</span>
  • CSS Classes: right social-icon
Two important things to note:
  1. Notice the "fa-hidden" class in the span surrounding the text
  2. The CSS Classes field may not be visible to you. If it is not visible, click on the screen options button at the upper right of your screen and make sure CSS Classes is checked in the "Show advanced menu properties" section.

The CSS

The CSS below is from the Sunshine State Skinny website. The .fa-hidden class moves the menu text off of the page, leaving just the Font Awesome icon visible. You may have to adjust the color, padding, and size to match your theme. This code produces icons that are white against the menu's black background.

The Result

If everything goes as expected, you should receive results similar to the Sunshine State Skinny menu below:

Sunshine State Skinny website menu
  • 7shares
  • Facebook0
  • Twitter0
  • Pinterest0
  • LinkedIn6
  • Print
  • SMS1

About Victor M. Font Jr.

Victor M. Font Jr. is an award winning author, entrepreneur, and Senior IT Executive. A Founding Board Member of the North Carolina Executive Roundtable, he has served on the Board of Advisors, of the North Carolina Technology Association, the International Institute of Business Analysis, Association of Information Technology Professionals, Toastmasters International, and the North Carolina Commission for Mental Health, Developmental Disabilities, and Substance Abuse Services. He is author of several books including The Ultimate Guide to the SDLC and Winning With WordPress Basics, and Cybersecurity.

Reader Interactions

VictorFont.com runs on the Genesis Framework

Genesis FrameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Check out the incredible features and the selection of designs. It's that simple—start using Genesis now!

Click here to download The Genesis Guide for Absolute Beginners (PDF - 1.4 MB)

Leave a Reply to WordpressDeveloper Cancel reply

Your email address and website will not be published. Required fields are marked *
Posting a comment means that you agree with and accept our Comment & Product Review Policy

Comments

  1. WordpressDeveloper

    August 4, 2017 at 1:50 am

    Excellent tutorial! This is really helpful to use in my business. Great work.

    Thanks.

    Reply

Call: +1 919-604-5828

Send us an E-mail

Accessibility Statement | Affiliate Marketing Disclosure | Capability Statement

Cookie Policy | Comment & Product Review Policy | Privacy Policy | Site Map | Terms & Conditions

Copyright © 2003–2022 Victor M. Font Jr.

Return to top of page
Posting....