Using WordPress as a Content Management System, Part 2
(Page 1 out of 3)Introduction
Welcome to part 2 of Using WordPress as a Content Management System series, where in I show you how to use WP as a CMS. In the previous part I have shown you how templates and plugins work, and I talked a little about a few common problems when using WP as a CMS.
This part will be a hands-on guide on how to convert a base install of WP to a fully functional CMS. I will guide you through the steps necessary, complete with code snippets and helpful tips. The only thing I won't talk about is design issues. In this tutorial I'm just going to use the standard WP design, but you can easily use your own design.
To follow this guide, you should first install a complete fresh copy of WordPress on your server, and make sure that all the templates files (located under wp-content/themes/default/) are fully write-able (CHMOD 777 to make fully write-able, but this could lead to security problems!).
Before we start, let's define what our website should have. Our WP website should at least have a news section and an articles section. It should also have a FAQ section, just to make it a bit more interesting. So our website will have three sections: news, articles, and FAQs. Let's get started.
The news section
The news section is actually the easiest section, as it closely resembles a regular blog. First of all, create a new category called 'News' in your admin CP. That category will hold all our news related content. You may also create sub-categories under the News category, as long as each entry also goes in the News category.
Now we have to change something in the 'Main Template'. Go to your Theme Editor (under 'Presentation') and click on 'Main Template' to edit it. Find the line that says:
And change it to:
the_content('Read the rest of this entry »');
} else {
the_excerpt();
}
?>
The above code makes sure that the entry is in the news category (2 is the ID of my news category; if yours is different, change it in the code), and if so, show the full content. If the entry isn't in the news category, then it should show only the excerpt. The reason for this will be made clear when we come to the article section.
That's about it for the news. You might also want to add a custom category page, which is extremely easy. Just copy the following file: category-2.source.phps, and save it as category-2.php in your template folder (/wp-content/themes/default/). Let's have a look at the article section now.
November 15th, 2005 at 6:09 pm
[…] PHPit - Totally PHP » Using WordPress as a Content Management System, Part 2 […]
January 26th, 2006 at 7:59 am
[…] part 1 | part 2 […]