If you haven’t already created a navigation menu, create one now and make sure you’ve ticked the checkbox in the menus screen so that it’s in the ‘Primary Navigation’ slot in your theme. In the WordPress Admin, go to Appearance > Menus so that you can edit your navigation menu. Now that we’ve got Font Awesome registered, we can use the CSS classes it provides to add icons to our menu items. That isn’t the best way to register stylesheets in WordPress: the method above is the way you should do it. Note that in the Font Awesome’s getting started page, you’re given instructions to call the stylesheet from the section of your web pages (which would be in the header.php file of a WordPress theme. Finally, it hooks the function to the wp_enqueue_scripts action hook, which tells WordPress when to run the function.Next it uses wp_enqueue_style() to enqueue the style it just registered.You can find this link on the Font Awesome site’s getting started page. Inside that function, it uses wp_register_style() to register the Font Awesome stylesheet, which is hosted outside your site. It creates a function called wmpudev_enqueue_icon_stylesheet().Before doing that, let’s take a quick look at Font Awesome: The next step is to activate the Font Awesome library in your theme. If you’re new to child theme, check out our comprehensive guide that explains how to do it. I’m going to create a child theme of the default theme, which is twenty fifteen. The easiest way to do this is by creating a child theme of an existing theme, which means you can add your own changes without doing anything to the original theme. If you don’t already have a theme you’re working with, you’ll need to create one. Add some styling to your theme’s stylesheet to get the layout and fonts right.Add CSS classes to the items in your navigation menu, via the WordPress admin.Activate the font awesome library from your theme’s functions file.Create a child theme of the twenty fifteen theme to work on (you can skip this step if you’re working with your own theme).These are the steps you’ll be taking if you follow along with this post: We’ll use the Font Awesome icon library, which you could add via a plugin but you don’t need to as you can easily call it from your theme’s functions file.Ĭontinue reading, or jump ahead using these links:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |