Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
In this first video we go over the basic template for controlling static pages in WordPress. This will give us the ability to display the main pages of our portfolio site.
-
0:00
[MUSIC]
-
0:04
The page.php template controls what static pages like the About page or
-
0:10
Contact page look like on your WordPress site.
-
0:13
Over the next couple videos, we'll look at how to set up the page.php template.
-
0:18
And then look at how to set up custom page templates for
-
0:21
when that page.php template won't work for all of your static pages.
-
0:27
Although we have an index.php file, which will serve up static page templates,
-
0:33
as we've seen on the site currently with our static home page,
-
0:37
what we wanna do now is create a page.php template which will work specifically for
-
0:43
working with static pages and not necessarily the home page or
-
0:47
other pages that the index.php may serve up.
-
0:51
What we're going to do though is take our index.php and
-
0:54
do a File > Save As page.php.
-
0:58
We could then update our no posts found message.
-
1:01
[BLANK_AUDIO]
-
1:04
And if you haven't seen this wrapped in the e before,
-
1:07
what this allows you to do is work with language files to be able to automatically
-
1:12
translate this statement into a different language that your theme could support.
-
1:18
So when we update this, what we need to do now is come into WordPress and
-
1:23
look at our pages that exist.
-
1:26
We could delete our sample page and we're going to add a new page called Portfolio.
-
1:33
[BLANK_AUDIO]
-
1:39
Add a new page called About.
-
1:42
[BLANK_AUDIO]
-
1:54
And then a Contact Us page.
-
1:57
I guess it's not us if it's an individual.
-
2:00
[BLANK_AUDIO]
-
2:11
We could also see that we have permalinks being the initial page ID, so
-
2:15
I'll go ahead and update these although it's not necessarily important for
-
2:20
the theme itself.
-
2:22
But now that we have these pages,
-
2:23
we're gonna click to view them from the admin area.
-
2:26
And the reason we're doing this is because our actual navigation is not working yet
-
2:30
on our site.
-
2:31
But if we click in this way, we could see, okay, great.
-
2:35
Here's the information.
-
2:36
And if we were to make an update, for example.
-
2:39
[BLANK_AUDIO]
-
2:44
We should see that reflected on the main site.
-
2:46
[BLANK_AUDIO]
-
2:49
So this page.php template is going to work for all pages and if we were to come back
-
2:53
and look at different pages, we would see that they're all using the same template.
-
3:00
However, it is possible to create custom page templates so
-
3:03
that you could have a range of options for displaying pages in different ways.
-
3:09
What we'll do in the next video is look at how to create additional custom
-
3:13
templates so that we could add something like a sidebar option for
-
3:17
our pages if we didn't wanna have a full width view like this page.
You need to sign up for Treehouse in order to download course files.
Sign up