SlideShare a Scribd company logo
1 of 7
How to Add Custom Icons to Your Navigation
Menu
It's always good to make your designs user friendly! When your design is
intuitive, it guides your user towards the right path all the while. Navigation
menus are one of the most intuitive areas of your design. You need to make
sure the menus talk for themselves. Adding custom icons to your navigation
menu will make the user understand where the tab will take them. Visual
cues are an interesting way to guide your users. Let's see how you can add
custom icons to your navigation menus without using plug-ins to direct you.
Well, the best part of this method is that you won't slow down your site with
additional image files as you don't upload any image files to be used in this
icon.
Create the Child Theme
Let's say you are working on the twenty fifteen wordpress theme. Now,
create a child theme for this main theme. When you create a child theme for
an existing theme, you can customize the theme without causing unnecessary
changes to the main theme.
FontAwesome Library
Your next step would be to activate the fontawesome library which you will
be using for custom icons. Font awesome is basically a library of all icons
created with an icon font. Like with other tools, you don't need to add
background images in case of this font library. Fontawesome basically uses
CSS stylesheets adding a pseudo element to an icon class. When you do this,
the pseudo element adds a special character to the element with an icon style.
The output is an icon added before the element to which you have just added
a CSS class.
Now, you know how fontawesome works, so let's activate it.
Create a new file in the theme folder and name it functions.php. in case the
theme folder has the functions.php file, paste the following code to the file.
<?php
function wmpudev_enqueue_icon_stylesheet() {
wp_register_style( 'fontawesome', 'http:////maxcdn.bootstrapcdn.com/font-
awesome/4.3.0/css/font-awesome.min.css' );
wp_enqueue_style( 'fontawesome');
}
add_action( 'wp_enqueue_scripts', 'wmpudev_enqueue_icon_stylesheet' );
?>
It is important to understand what's happening here
First a function wmpudev_enqueue_icon_stylesheet is created and the
fontawesome stylesheet is registered to this function. Next, the enqueue code
is used to queue up the stylesheet that has been registered. Finally, with the
wp_enqueue_scripts, Wordpress knows when to run the function and use the
stylesheet.
Finally, you will need to save the functions.php file which contains your icons.
Add CSS to Menu
You have registered and activated fontawesome to the functions.php file of
your child theme. Now, you can easily use the CSS classes within it to add the
icons to the menu items.
Go to Appearance>Menu>Edit Navigation Menu
Here you can add CSS class to individual items within the navigation menu. Of
course, you will need to perform a few steps before you can actually view
them.
At the top of the screen, go to screen options and check the CSS classes. Now,
you can start adding the icons to the individual elements.
For example,
fa fa-lg fa-home
fa: this is a code used for all the items that include font awesome icon
fa-lg: icon size set to large
fa-home: the icon that you want to display
Now, you can perform the same on the other items on the menu
When you are finished, save the menu icons with "Save Menu" button
Styling the Menu Icons
By just adding the icons to the menu items, you have processed the adding
step. But, you need to make sure it appears nice along the frontend. That's
why styling is important
You will need to now tweak the appearance of the menu items.
Let's begin. First step is to pull the menu items one over the other. Add the
following code to the theme's stylesheet
.main-navigation ul li {
width: 100%;
}
With this, you can ensure that each menu item takes about 100% width of the
containing element. Now, you will need to pull the icons to the left of the
menu. Here's the code that will help you with this process.
.fa::before {
float: left;
}
Now, add a code to style the margin and width so that the menu looks a bit
neat
.fa::before {
float: left;
margin-top: 8px;
width: 30px;
}
Finally, you will need to adjust the font for the text within the menu
.main-navigation ul li.fa.fa-lg a {
font-family: 'Noto Serif', serif;
font-size: 0.8em;
}
Let's take a look as to how the final stylesheet would look, so that your
navigation menu with custom icons looks neat
/*
Theme Name: WPMU DEV Custom Navigation Menu Icons
Theme URI: http://rachelmccollin.co.uk/wpmudev-custom-menu-icons
Description: Theme to support WPMU DEV post on custom menu items
Author: Rachel McCollin
Author URI: http://rachelmccollin.co.uk/
Template: twentyfifteen
Version: 1.0
*/
@import url("../twentyfifteen/style.css");
/* styling for menu icons */
.main-navigation ul li {
width: 100%;
}
.fa::before {
float: left;
margin-top: 8px;
width: 30px;
}
.main-navigation ul li.fa.fa-lg a {
font-family: 'Noto Serif', serif;
font-size: 0.8em;
}
With this custom icons added to the navigation menu, you are ready to give
an ultimate experience to your users.
Conclusion
When you add custom icons to your navigation menu, you are actually giving
out an experiential interface to your users. An intuitive website offers better
user engagement, and helps improve conversions. A custom icon is a great
way to make your website look simple yet interactive.
Original Source:
http://www.wamda.com/deeparanganathan/2015/05/how-to-
add-custom-icons-to-your-navigation-menu
}
.fa::before {
float: left;
margin-top: 8px;
width: 30px;
}
.main-navigation ul li.fa.fa-lg a {
font-family: 'Noto Serif', serif;
font-size: 0.8em;
}
With this custom icons added to the navigation menu, you are ready to give
an ultimate experience to your users.
Conclusion
When you add custom icons to your navigation menu, you are actually giving
out an experiential interface to your users. An intuitive website offers better
user engagement, and helps improve conversions. A custom icon is a great
way to make your website look simple yet interactive.
Original Source:
http://www.wamda.com/deeparanganathan/2015/05/how-to-
add-custom-icons-to-your-navigation-menu

More Related Content

Recently uploaded

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

How to Add Custom Icons to Your Navigation Menu?

  • 1. How to Add Custom Icons to Your Navigation Menu It's always good to make your designs user friendly! When your design is intuitive, it guides your user towards the right path all the while. Navigation menus are one of the most intuitive areas of your design. You need to make sure the menus talk for themselves. Adding custom icons to your navigation menu will make the user understand where the tab will take them. Visual cues are an interesting way to guide your users. Let's see how you can add custom icons to your navigation menus without using plug-ins to direct you. Well, the best part of this method is that you won't slow down your site with
  • 2. additional image files as you don't upload any image files to be used in this icon. Create the Child Theme Let's say you are working on the twenty fifteen wordpress theme. Now, create a child theme for this main theme. When you create a child theme for an existing theme, you can customize the theme without causing unnecessary changes to the main theme. FontAwesome Library Your next step would be to activate the fontawesome library which you will be using for custom icons. Font awesome is basically a library of all icons created with an icon font. Like with other tools, you don't need to add background images in case of this font library. Fontawesome basically uses CSS stylesheets adding a pseudo element to an icon class. When you do this, the pseudo element adds a special character to the element with an icon style. The output is an icon added before the element to which you have just added a CSS class. Now, you know how fontawesome works, so let's activate it. Create a new file in the theme folder and name it functions.php. in case the theme folder has the functions.php file, paste the following code to the file. <?php function wmpudev_enqueue_icon_stylesheet() { wp_register_style( 'fontawesome', 'http:////maxcdn.bootstrapcdn.com/font- awesome/4.3.0/css/font-awesome.min.css' ); wp_enqueue_style( 'fontawesome'); } add_action( 'wp_enqueue_scripts', 'wmpudev_enqueue_icon_stylesheet' ); ?>
  • 3. It is important to understand what's happening here First a function wmpudev_enqueue_icon_stylesheet is created and the fontawesome stylesheet is registered to this function. Next, the enqueue code is used to queue up the stylesheet that has been registered. Finally, with the wp_enqueue_scripts, Wordpress knows when to run the function and use the stylesheet. Finally, you will need to save the functions.php file which contains your icons. Add CSS to Menu You have registered and activated fontawesome to the functions.php file of your child theme. Now, you can easily use the CSS classes within it to add the icons to the menu items. Go to Appearance>Menu>Edit Navigation Menu Here you can add CSS class to individual items within the navigation menu. Of course, you will need to perform a few steps before you can actually view them. At the top of the screen, go to screen options and check the CSS classes. Now, you can start adding the icons to the individual elements. For example, fa fa-lg fa-home fa: this is a code used for all the items that include font awesome icon
  • 4. fa-lg: icon size set to large fa-home: the icon that you want to display Now, you can perform the same on the other items on the menu When you are finished, save the menu icons with "Save Menu" button Styling the Menu Icons By just adding the icons to the menu items, you have processed the adding step. But, you need to make sure it appears nice along the frontend. That's why styling is important You will need to now tweak the appearance of the menu items. Let's begin. First step is to pull the menu items one over the other. Add the following code to the theme's stylesheet .main-navigation ul li { width: 100%; } With this, you can ensure that each menu item takes about 100% width of the containing element. Now, you will need to pull the icons to the left of the menu. Here's the code that will help you with this process. .fa::before { float: left; }
  • 5. Now, add a code to style the margin and width so that the menu looks a bit neat .fa::before { float: left; margin-top: 8px; width: 30px; } Finally, you will need to adjust the font for the text within the menu .main-navigation ul li.fa.fa-lg a { font-family: 'Noto Serif', serif; font-size: 0.8em; } Let's take a look as to how the final stylesheet would look, so that your navigation menu with custom icons looks neat /* Theme Name: WPMU DEV Custom Navigation Menu Icons Theme URI: http://rachelmccollin.co.uk/wpmudev-custom-menu-icons Description: Theme to support WPMU DEV post on custom menu items Author: Rachel McCollin Author URI: http://rachelmccollin.co.uk/ Template: twentyfifteen Version: 1.0 */ @import url("../twentyfifteen/style.css"); /* styling for menu icons */ .main-navigation ul li { width: 100%;
  • 6. } .fa::before { float: left; margin-top: 8px; width: 30px; } .main-navigation ul li.fa.fa-lg a { font-family: 'Noto Serif', serif; font-size: 0.8em; } With this custom icons added to the navigation menu, you are ready to give an ultimate experience to your users. Conclusion When you add custom icons to your navigation menu, you are actually giving out an experiential interface to your users. An intuitive website offers better user engagement, and helps improve conversions. A custom icon is a great way to make your website look simple yet interactive. Original Source: http://www.wamda.com/deeparanganathan/2015/05/how-to- add-custom-icons-to-your-navigation-menu
  • 7. } .fa::before { float: left; margin-top: 8px; width: 30px; } .main-navigation ul li.fa.fa-lg a { font-family: 'Noto Serif', serif; font-size: 0.8em; } With this custom icons added to the navigation menu, you are ready to give an ultimate experience to your users. Conclusion When you add custom icons to your navigation menu, you are actually giving out an experiential interface to your users. An intuitive website offers better user engagement, and helps improve conversions. A custom icon is a great way to make your website look simple yet interactive. Original Source: http://www.wamda.com/deeparanganathan/2015/05/how-to- add-custom-icons-to-your-navigation-menu