Adding Social Media Links to WordPress Menu With CSS Classes

WordPress features has been improved in every versions they are updated. So are the menu or navigation functionality.

In the past, we need to code our theme to display some social media links, but now we can even add the CSS classes on those menus, and link them to our social media profiles or page.

Today, we are going to add media links to our menu using Twenty Fourteen theme. This will work to all the themes, as long as the theme is compatible with recent WP version I am using in this post (v.3.9.1)

In the video I even mentioned that there are many ways, you can add the CSS social media buttons, then with images, and with Genericons, which is already built-in with Twenty Fourteen. Not all theme have Genericons pre-embedded though.

This method is the best one in my opinion, since it won’t need any images, means, less resources to be loaded in your website.

The second choice, will be, having Genericons, same with the CSS based social media links, it won’t disturb the loading speed of your website.

What do we need before we start it? I strongly suggest you to create child theme of it.

How do we add Social Media Links to WordPress Menu?

We actually will add the 3 “Links” to the menu for this example, pointed to your Facebook page, G+ (Google Plus), and Twitter in this post.

Then, we add the CSS classes to them, so we can modify the colors style of the link, and the hover state with basic css modification.

Of course, you can add other social media links, like YouTube, vimeo, LinkedIn, etc with this simple method.

Related: How to Remove Twenty Fourteen Author Name or Link

If you have already the child theme, let’s start :)

1. In dashboard, go to Appearance then, “Menus“.

2. Create or edit your menu.

3. Click “Screen Options” I would check everything.

Screen Options Menu paage

Screen Options Menu paage

3. On “Links” section;

Links - Facebook page URL and Link Text

Links – Facebook page URL and Link Text

Menu structure

Menu structure

For Facebook, click the tab, and enter your Facebook page URL in “URL” box, and “Facebook” for the Link Text. Click “Add to Menu“.

Then in “Menu Structure” section on the right, click “Facebook” – “Custom” arrow icon. You will see these option.

The most important here is the “CSS classes” because we want to style our menus.

I name it as “facebook-menu” class.

For the title attribute, I typed, “Facebook page”. You can also leave it empty, because this is the text when we hover, it will show the menu’s title attribute.

This menu has "Facebook page" as Title attribute

This menu has “Facebook page” as Title attribute

Repeat the step for Twitter and G+ link.

For twitter, I name the CSS class, as “twitter-menu

Twitter menu option

Twitter menu option

Same with Google Plus, I give it to have the class as “googleplus-menu

Google plus css class

Google plus CSS class

Don’t forget to click “Save Menu” button whenever you add these links.

4. In the child theme’s style.css add these css code to style the hover and the menu background color. Click “Update File“.

You can replace the color with colorpicker.com if you don’t have color picker addon.

Share the knowledge
Share on Google+0Tweet about this on TwitterShare on Facebook0Pin on Pinterest0Share on Reddit0Email this to someonePrint this page