The WordPress Sidebar and Footer Templates

You can use the sidebar and footer template tags that pull in the information you want to include in your WordPress blog. These tips will get you going with creating your own theme or with editing the template tags in the theme you’re currently using.

The Sidebar template

The filename of the default Sidebar template is sidebar.php. Typically, the sidebar is displayed on the right or left side of your WordPress template. In the default Twenty Fourteen theme, the sidebar is displayed on the left side of the template, by default.

Similarly to the Header template, the Sidebar template is called into the Main Index template with this function:

<?php get_sidebar(): ?>

This code calls the Sidebar template and all the information it contains into your blog page. There are additional ways you can call in the Sidebar template, including having multiple Sidebar templates and using an include statement to pull them into the Main Index template.

The Footer template

The filename of the Footer template is footer.php. Usually, the footer sits at the bottom of the page and contains brief information about the site, such as copyright statements, credits to the theme designer or hosting company, or even a list of links to other pages within the site.

The default Twenty Fourteen theme shows the site title and a statement that says “Proudly powered by WordPress.” You can use the footer to include all sorts of information about your site, however; you don’t have to restrict it to small bits of information.

Similarly to the Header and Sidebar templates, the Footer template is called into the Main Index template through this bit of code:

<?php get_footer(); ?>

In Twenty Fourteen, the calls for the Sidebar and Footer templates are written as part of a larger call and are written like this:

<?php
get_sidebar();
get_footer();
?>

It is possible, and common, to wrap two template tags in one PHP function like that, if they appear directly after one another. The examples separate them out into single functions to make sure you’re clear on what the actual function is.

This code calls the Footer and all the information it contains into your blog page.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.