Viewers: in countries Watching now:
With the index template looking exactly how we want it, we have to make sure our other archive templates also match this design. So if you go to the front page of your site and scroll down until you find this post called markup HTML tags and formatting and click on the link to the markup category. You'll see that we have a bit more work to do. At the top of each archive page you have the archive title, telling you what archive you're currently looking at. And you also have an optional description for some of the archives. So for instance, tags and categories can have custom descriptions.
Now we need to apply styling to these elements to make them line up with the rest of the content and appear part of the overall design. If I right-click on any of these elements and inspect the code, you'll see that this whole header section is wrapped in a header tag with the class page header. And within that we have an H1 with a class page title and also a div with a class taxonomy description. So these are the elements we need to apply styles to. The first thing you have to do, is get the section here to shift over and appear above the main content.
And if you think back, we've. Previously had a similar situation with another element. It was the paging navigation that was on the bottom of our pages. So now we can borrow the same styles that we applied to the paging navigation to get the header here to look the same. The paging navigation style I'm talking about, was placed inside layouts and content side bar. And here, if I scroll all the way to the bottom, you'll see this is the style paging navigation and it applies a background of white and then some padding around the box.
So here, I'm going to append another class to it, so I'll say page-header, comma and save it, and then go and reload my page and see what happened. So now my page header has the background it needs but of course it's not aligning properly and that's because we need to add the alignment as well. And just like with this rule set here, we also have a previous rule set we created for all our alignments. And it has two components. It starts off here at the top where we have entry header, entry content, and so on.
So here I can add in, page-header, and this first rule sets the full width, and also aligns it to the center. And then we have the additional, media query that we use to align the content to the right on medium-sized screens. So here I'll add my as well. Save one more time, and reload the page. And now my page header aligns properly. Now that I have the page header in the place I want, I need to go back into my code snippets and apply some styles to this description, because I want the description to appear not part of the content.
I want to apply a different font family to it. And do some other things like remove the border at the bottom here. So if you go back to the code snippets you'll find a custom rule, just for taxonomy description. I'll copy that out, and this time I'm going to go to style dot css and add it in. And here I need to find my index pages section which I remember is right over 11. And then I'll place it right before here. So taxonomy description. I'm setting padding on the top and the bottom. Setting the font family. Setting the font to italicized and adding a border at the top and the bottom, so that the description is clearly separate from the title.
Save style dot css. Reload the page. And now my taxonomy description is separated from the title. Now that it looks right, we need to make sure that the output of this section is correct because if I now go and switch to something else, let's say April. 2014. You'll see it says, Month: April 2014, And the underscore's theme has applied a bunch of predefined text that comes out depending on what type of archive page you're in. And you may want to change this text to something else.
In particular. I don't like the wording for categories because it just says the name of the category. It doesn't tell you that this is a category. All of this is controlled from the archive dot php template. And if you go into archive dot php, and you scroll down a little bit, you see, here we have the page header, followed by the H1 class page title. And within that class, we have a long list of conditional statements that test for different scenarios. So here we have. Is category, and then it just displays the title of the category. If it's a tag, it displays the title of the tag.
If it's the author, then you get author colon and the author name. It it's day, you get day colon and date and so on and so on. And then we have a long section here for Asides, and Galleries, and Images, and all the other post formats. And at the very bottom, we have a fallback that just says, Archives. So I want to change these elements, so that they output exactly the text that I want. In particular I want categories to say, category, and then the category name. So if you go to the codes scroll down, you'll see here I've made an alternate version of this top text.
So what happens now is, instead of just saying the category name. This function says if we are on a category, it'll say post in the, and then spell out the category and title, and then category, so I'll say post in the markup category. Same with the tags and I've also added some slight changes to some of the other texts, and I've removed all of the post formats we don't need. So I'm going to copy this out, and then going to replace everything from this php delimiter here, all the way up to the start here, and when I save this, and go back and reload the page, so you'll remember this is a category page, the title will say pause in the markup category, and I notice that there is a small error here, so I'm just going to go in and change that.
So that there's a space after the m here and probably the same for the tag and now we have more informative titles for our category pages, regardless of which page we're on.
There are currently no FAQs about WordPress: Building Themes from Scratch Using Underscores.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.