Build Your Own Business Website header image

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

Lesson 8 – Part 7 – Understand Thesis Templates

Difficulty Level -

Filed Under Topics -

Listed Under Lesson Subjects -

Applies to -

We’re now going to talk about a topic that has confused a lot of people that I hope to explain here and that is the concept of templates.

All this time when I was managing the header image and all the rest of that stuff, we were actually working on what’s called the front page template. But there are a number of other templates that Thesis automatically provides you with and Agility has one that’s specific to Agility.

Available Templates

And you have a home template. A single template and where these little X’s are, this little plus sign if you expand it, you can see that there are child templates under single. You have a page template and the front page is a child of page. We’ve been working on our front page but it’s under page and then you have archive and all of these other archive templates.

And I have created this template called No Sidebars as a custom template which is essentially a template that is full width and doesn’t have a sidebar on the sides so the content is the full width of the page, very similar to the front page template.

Now templates have always existed in WordPress and WordPress has always had these templates, a home template, a single template, a page template, a front page template, a 404 page template, archive templates. Because what WordPress does is it generates these various types of pages based on a certain set of conditions.

So if somebody clicks on the home page, it takes them to the home template. If somebody clicks on a regular page, it takes them to a regular page template. And the way this works is that you have to style at a minimum, 3 different templates. In our case, with Agility, it’s really 4 different templates in order to completely style your skin.

When the Front Page Template Applies

The one we’ve been working on is our front page template and it always only applies in one situation. You have a front page template always and only when you have a static front page. Remember last week, we created a static front page instead of a blog post page or an articles page? That static front page, this template, only applies to that. It will never apply to any other page and no other template can apply to the static front page.

So if you don’t have a static front page, if you’re building a blog website and you don’t have a static front page then this template doesn’t even show up in your list and you wouldn’t be styling this.

Home Template Applies to the Blog Posts Page

The next template is the home template and the home template always only applies to the blog posts page. This is a little confusing because the terminology in WordPress has evolved over time.

Once upon a time, WordPress was just a blogging platform and the home page always just displayed all of your blog posts. And there never was such a thing as pages. You just had a home page. You had blog post pages and you had archive pages that showed you your categories and things like that. But there was no such thing as a regular page page.

Then they decided, “Well it would be great to be able to have just a regular page page that didn’t show up on your blog posts page.” And so they added pages. And then somewhere just before I started using WordPress, they said, “Well, some people are going to want to use this as a regular, old website, not as a blog. And so we should give them the opportunity to create a static home page.” And they landed on this terminology of front page rather than home page, retaining the term home for a blog posts page or the page that displays all of your blog posts.

Difference Between Home Page and Front Page

People find this confusing and for a good reason because ordinarily, you’d think of your home page as whatever page you get to first. When you type in your URL, it takes you to your home page and that is true. That is your home page. But WordPress calls the template that displays that either front page or home. It’s one of the two. And it displays the front page if you’ve got a static front page and it displays the home template for your blog posts page.

Using the Home Template for our Articles Page

Your blog posts page will always only use the home template, even if it’s not your home page. So in this case our blog posts page is our articles page and our articles page takes all of our blog posts and displays them as individual articles. And the template that governs this view is the home template.

And you can see that here actually, it says home down here. If we go over to the front page, it says front page.

The Page Template

If you go to a standard page, now you’re actually working with a page template. And the page template applies to all pages, not the front page, not the blog posts page, not single posts but to all pages.

And pages are things that you create when you add new page. So the page template always applies to something here when you say add new page. When you add a new page, the page template’s automatically going to apply to it.

Custom Templates

You could actually apply a custom template to a page. And Agility comes with a No Sidebars custom template and this is how you would apply it. But if you didn’t choose a custom template, the page template would always apply to the page unless you select the custom template otherwise.

You can’t select the custom template for your blog posts page and you can’t select the custom template for your static front page. Those two templates always only apply to those two pages. But the page template applies to all pages unless you select the custom template for it.

Single Template Applies to Single Posts

The next type of template is the single template. And the single template always applies to a single post. That’s the kind of template that’s used when a single post is displayed. So it could be similar to your page template but usually, you have other things that you add to the single post template that you don’t add to a page template and we’ll look at those later on.

And that template is always applied when you come over here and under post, you say add new post. All of the posts automatically get the single post template applied to them unless you come down here and select a custom template for it. But if you don’t select a custom template for it, it’s automatically going to get that single template.

Archive Template Applies to Collections of Posts

We have one more kind of template to talk about and that’s the archive template. This term ‘archive’ also confuses new people a bit because the concept of an archive means something in English that it doesn’t mean at all in WordPress. In English, archive suggests something that you’re putting aside that you’re not really getting at unless you really have to. You don’t want to throw something away but you also don’t want it in your way so you stick it in your archive.

That’s not what Archive means in WordPress. In WordPress, Archive means a collection of posts displayed by some governing characteristic. So a page that displays all of your posts that have a specific category is called the category archive page.

A page that displays all of your posts that are tagged with a certain tag is your tagged archive page. A page that displays all of the posts written by a specific author is the author archive page. Your search results is a search results archive page.

What all of these pages have in common is that they are displaying posts or lists of posts that share some common characteristic, whether it’s category tag, taxonomy, author, day, month, year or showed up in search.

We’re not going to get around to styling archives for a while so we’re not going to worry about that for the moment. And we’re not going to get around to styling a single template for a while either since we don’t get to the blog until later in the course.

Parent – Child Relationships in Templates

Notice how when you click on this little plus, something drops down below, right? And this is to indicate a parent child relationship. The way the parent child relationship works is that if you don’t edit the child template, it automatically takes all of the settings and configuration of the parent template.

We’ve been editing our front page template so in fact, our front page template is not the same as our page template any longer. It never was in Agility because Agility has always been set up as having a different front page than the rest of its pages.

However, Agility is also set up so that all of its archive pages are identical which means that the category archive tag, archive taxonomy, archive templates have not been customized. And therefore, since they have not been customized, they take all of the styles, configuration, layout and everything of the archive template.

This is the way in which the parent child relationship works. The children adopt everything from the parent until you edit the child template. And as soon as you edit the child template, it never adopts anything else from the parent. From that point on, it is its own template and any changes you make to the parent template do not affect the child template.

If you haven’t specifically edited the child template, any change you make to the parent template is made to all the children until you edit it. At which point, that relationship, that transference of information is broken.

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
THIS IS A LIMITED TIME OFFER!
Subscription Options
0 Comments… add one
0 comments… add one

Leave a Comment