Customizing the WordPress footer by adding widgets

The footer is often overlooked when it comes to designing a site, but it’s a great way to find contact details or other important pieces of information. People have been trained to look there since the days of letter writing. Even today if you look at any correspondence, utility bill or company letterhead you’ll find important information. On websites it’s an can be an important navigation tool, it can give you quick access to commonly needed pages that are not core to a site.

In this quick tutorial we’ll be adding the ability to show standard WordPress widgets (like menus, categories or search) in your template.

Adding a sidebar

To start we need to register a custom sidebar that we’ll show in the footer.php. We do this in the functions.php of your theme. We need to hook in to the ‘widgets_init’ action using add_action and create our function

Now we can add our sidebar using the register_sidebar function. All we need to do is specify the sidebars name, an id and description. We also specify the HTML we want to wrap the widget and its title in.

Here you can see I’m specifying the HTML5 element aside. The aside element, in general is used to display tertiary or related content to the main content, here I feel it makes sense as this information will be related to the site overall.

Comments

Popular posts from this blog

Why choose Workholics.com as your SEO company?

How to Speed up Your Website