Building A Static Site Using WordPress – Part 2
Sarah is a Web Developer specialising in PHP coding and WordPress. She runs several blogs all accumulated at Blogging by Sarah.
Other Articles In This Series
- Building A Static Site Using WordPress – Part 1
First off, the following post assumes you are capable of installing WordPress onto your computer or own hosting. If you’ve never done this before then I have a post on Installing WordPress which I recommend you read first. This post shouldn’t be taken as an in-depth guide but more of a simple start to give you an idea of how you can use WordPress to power your standard website.
So, you’ve got WordPress installed and ready to get started. First off we need to get the content on the site. Don’t worry if you don’t have much content yet. WordPress makes it so easy to add further pages that you can start off with a few and continue adding as and when the content is ready. Of course I don’t recommend launching a new site which is only half finished, but if you can get away with it sounding/looking complete then the quicker is running, the sooner you can start getting visitors in and hopefully start making money!
Create the Front Page
To create a static page, in the admin area you go to Write > Page. The Write Page section is almost identical to the Write Post section. To create your page give it a title and add the content into the content area. At this point you could stop but there are a few parts of the section to understand when it comes to creating a static site.
First off is the Discussion options. I’m not sure why pages can have comments or pings, but I guess that’s left over from the blog side of WordPress. In your page template you can delete the comment form and comment display, however if you’re using the default page template then I’d recommend you untick these just to be on the safe side. Page Status is handy to allow you to preview your page before the world can see it. Save it as a draft and whilst you’re logged in as Admin you can still view the page, make corrections and then finally publish it when you’re ready. If you want to password protect the page then set a password for it. This is one password that you give out to anyone you want to allow access. It’s not a great way in my opinion to control page access and I’ll go into a plugin that’s much better for this.
Page Parent allows you to create sections or categories within your page structure, useful when your site is going to be quite large. You can either create the page as a main page or as a child of another page. The page slug is used in the URL when you’re using permalinks however it will automatically create the slug from the page title, so unless you drastically change the page title then you don’t need to touch this. The page author isn’t of much importance here, and finally the page order…
The Page Order allows you to control the order in which the pages are displayed in the menu on the front end. This allows for complete control over how the menu appears. The page order works for each ‘level’ of pages ie. parent, child, grand child and so on. Simply assign a number for each page and then, providing the correct template tag is used to display the menu, the pages will display in the ascending order of the numbers you’ve given.
Assign the Front Page
Now that you have a front page created you need to go to Options > Reading. The first option is the Front Page. Here you want to select that the front page displays a static page, and then select your newly created front page as the ‘Front Page’ option. You can leave the ‘Posts Page’ option as it is.
If you now go to the front end of your site you should see your front page as the welcoming page on the site. Now you need to continue adding your pages of content to pad your site out and create an actual site.
What about the Blog?
If you can have some sort of continuing information on the site, such as news stories or events, then this is where the blogging power of WordPress can still be utilised. Rename the category ‘Uncategorised’ to ‘News’ or something more appropriate, and then use this to add your stories. This is a great way to potentially get visitors into the site via blog searches and the blog world, and then hopefully from there your visitors will investigate the site further and get to the content you want them to see. The content that will make you money 😉
To create page templates you’ll need (x)HTML knowledge, potentially some CSS knowledge and some understanding of PHP. If you want to get into page templates then you want to bookmark the Template Tags page on the WordPress Codex. However, most standard sites shouldn’t need much altering once you’ve found yourself a good theme to use.
The code I will explain is the code to control how your pages menu displays. If you’ve used the page ordering, as mentioned earlier, and your pages are coming out in the wrong order, then the settings are probably wrong for your needs. Open up your sidebar.php file and look for the code that starts
This is the function that’s displaying your pages. You may have various options between the brackets which will differ from theme to theme. To understand all of the options available I recommend you read the wp_list_pages Page on the Codex. However, to control the order look for an option called ‘sort_column’. If it’s there then change this from
Where XXXXX could be ID, post_title, post_name, or others, to
Also, if the sort_column parameter is not there then add this into the brackets. If there are other parameters present, then put the sort_column parameter at the end of the parameter list with an ampisand (the & sign) before it.
Improving the Site
There are a few plugins which I always install for any website I set up.
- SEO Title Tag
- Allows you to change/expand the title of pages, categories and posts.
- Sitemap Generator
- This creates a normal Sitemap including pages and posts. Handy for client managed sites where they add new pages etc.
- Login Anywhere
- Allows you to display the WP admin login on the front of the site (useful for sites that have multiple accounts or want to control access to posts).
- Page Restriction
- Allows you to restrict page access to only those who are logged in, such as subscriber based content.
- Google Sitemaps
- Generates an XML sitemap of your pages and posts.
- Search Everything
- By default WP search only searches posts. This expands the search to pages too (a must for CMS use if you want to have a site search). From what I’ve seen this may be included in the next version of WordPress.
One other plugin that I should mention, it’s not for CMS usage or improvement but more for your own work environment improvement. Drop Down menus for Admin. Since discovering this plugin I can’t work without it now! Turns your admin menus into drop downs so no more two clicks to get anywhere!
Hopefully these two posts of mine will have given you the idea of how WordPress can be altered and expanded to become a lightweight CMS, easy to use to power your web site. You don’t really need to know any coding to set your site up, and the ability to have a site set up, configured and ready for content within an hour, you really have no excuse 😉
I have more indepth WordPress posts on the individual sections, and am continually adding tutorials and information as and when I can. Also the WordPress Codex is a great place to look over once you’ve started to understand the basics (else it could be a little overwhelming!).