3.1 Creating a Static Page
1.Introduction2 lessons, 05:33
2.Creating Posts2 lessons, 21:52
3.Creating Pages2 lessons, 13:02
4.Conclusion1 lesson, 02:31
3.1 Creating a Static Page
Hello, and welcome back to this Tuts+ course, on creating content with Posts and Pages in WordPress. In this part of the course, we're gonna move on from Posts and start looking at Pages. So I'll show you how to create a page in your WordPress site. So to do that, we need to go over to the Pages item in the Admin menu. And you can see once again, just like Posts, there's Add New option here. Or there's a button here. And at the moment, I don't have any pages in my site. Now once again, when you setup a clean installation, you will probably have a page already in there as a sample page. Again, you can delete that and start fresh, or you can edit it. I've deleted mine. Our quick tip,you can also add new posts and pages by going up here in the toolbar. So you could select post or page, and if you just clicked add new, it would add a new post. So that's a good shortcut. So I'm gonna add a new page this way. And I'm gonna call this page home, cuz I'm gonna create a static homepage for my site. Now if you want to list your blog posts on your homepage, you don't create a page for them. You just tell WordPress to do that, and WordPress will automatically generate a blog page. I'm gonna create a static page called Home. Now, pages and posts work in exactly the same way when it comes to blocks. So I can add all the same block types to my page, as I can to my posts. But there are some differences. So, let's look in the document pane over here, you can see I can't add categories or tags. You can't categorize your pages. And you can't sort them in any way. They are static content, designed to be accessed from the navigation menu, rather than via archive pages. You can set a featured image. And I'm gonna set the same featured image cuz that's one I've already got in my media library. You can allow comments. I'm not going to, cuz it's my homepage. And you can schedule it if you want to. Another thing you can do, is a page attributes. And this gives you an order. If these pages are being listed by a plugin, or a widget, or something like that, you could specify what order the pages are in. So it goes in ascending order, so you could add 0 and then 1, 2, 3, 4, and they will be listed in that order. Now to be honest, that's something that I don't use very much these days. It used to be, that WordPress would automatically generate navigation menus, using that page attributes function. But these days, you manually add your pages to your navigation menu, so that you can put them exactly where you want them to be. So I'm gonna publish that. Now because I'm creating a static home page, I also need to create a page for my blog posts. And again, if you're using your home page for blog post, you need to do that. You don't create any page at all for home or blog posts. WordPress will just automatically do it for you. So I'm gonna create a new page here. And I call that Blog, and I don't add any content to it at all, because WordPress auto populates this page. So I'll publish that. And now if I go to the all pages listing, we've got Blog and Home. Now I need to tell WordPress that this is my homepage, and that it will live on the main page of my site. And I do that via the settings, reading screen. So I go to settings and then reading, and you can see the default is latest posts. And that just happens without you having to add any pages. Here I'm adding a static page, and I select the homepage, and the post page. So I now tell WordPress which of the two pages are created, it's gonna use for what? So I'll save those changes, and then if I go to the home page of my site which I can do by clicking on the name of the site up here in the upper menu. You can say we're on the the home page. So, right now, in my navigation menu, I've got home and I've my categories. So let's change that navigation menu, let's just check home link is working. Even though I changed my homepage, work press is caught up with that. And I'm gonna click on customize, and then menus. I've got my main menu, and I'm going to add another page. So I've got Blog. I'm gonna add that up here. So I can see if I test that out. If I click on Blog. I go to Blog, which gives me my latest post first. And if I go to Home, it takes me to that static homepage. So I'm happy with that. And again don't forget, I'm in the customizer, so I have to click the Publish button, because nothing is saved until I do that. It's just draft. It's a bit like previewing a post before you publish it. So I'll click the cross, come out to that, which will take me back where I was, which was the homepage. I'm gonna go to my Blog page, and that's another static page. Now let's add another static page, and I'm going to call this Contact. So on this page, it's a fairly standard page that most sites have, a contact page with details on how to get in touch with you. And again, I've got all the same settings for my document, that I did for other things. I don't want comments on my contact page. I can set a featured image if I want. In this case, I'm not going to. And it will look slightly different. And I can schedule it, if I want. But it's very unusual to schedule pages, because they're not time-dependent, in the same way the posts are. So I'm gonna publish that, click on Publish twice. I'll view my page, here it is. So there's no featured image there at the top, there's just the contents of the page. So, if I go back to edit that, I might use a block for form. Now at the moment, I don't have a forms plugin installed, so I would need to install a plugin that added a contact form to my site. And there are plenty of free plugins that you can use, to add a contact form to your site. And you need to install those in the same way you'd install any plugin. And again, you could use a Google Maps plugin for example, to add a map. So I'm gonna update that, cuz I made some changes to it. And I'm gonna add it to the menu. So, I'm gonna go into the customizer and when I'm in the admin screens, I don't have access to the customized link at the top. Instead, I get to appearance and customize, and then Menus. Select my main menu, add items and I click on Contact to add that, I'll add that to the end. I click on Publish, very important not to forget that. I click the cross to come out of the customizer. I go to my homepage, then I save. I click on Contact, that's my contact page. So I can also add pages in a hierarchical way in my menu, in the same way as I did with my categories here. So I could add different pages for different offices, and add them to the menu underneath the Contact page. But I'll show you how to create hierarchical pages themselves in the next part of the course, and I'll also show you how to use page templates. See you next time, and thanks for watching.