WordPress themes are part of what makes WordPress so popular. Before we start coding we need to understand a little bit of how WordPress themes work. When we are creating a new WordPress theme, we need to create some files that will be recognized automatically by WordPress. Most of the files are self-explanatory, but let's take a look at them:
header.php
: When we load a blog, WordPress transforms it into a single HTML page so that the browser can render it. Theheader.php
file contains the theme code until the</head>
tag.sidebar.php
: This is an optional file that can be called by using the WordPressget_sidebar()
function. This is where we can add the code to render widgets and also render the Sidebar of the theme, in case it has one.footer.php
: This is where we will end our HTML code to wrap up the theme. You can also display widgets here if you would like.page.php
: This is used to display a single page. Examples of single pages are about...