ASPit - Totally ASP JSit - Totally JavaScript
Search PHPit

Use this textbox to search for articles on PHPit. Seperate keywords with a space.


Using WordPress as a Content Management System, Part 2

(Page 1 out of 3)


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:

the_content('Read the rest of this entry »'); ?>

And change it to:

if ( in_category(2) ) {
the_content('Read the rest of this entry »');
} else {

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.

Next: Article Section »

2 Responses to “Using WordPress as a Content Management System, Part 2”

  1. » Ссылки за 15.11.2005 « Заметки веб-разработчика « ZOOB Says:

    […] PHPit - Totally PHP » Using WordPress as a Content Management System, Part 2 […]

  2. WordPress TestBlog » Blog Archive » some good-looking articles abt WordPress as CMS Says:

    […] part 1 | part 2 […]

Leave a Reply

About the author
Dennis Pallett is the main contributor to PHPit. He owns several websites, including ASPit and Chill2Music. He is currently still studying.
Article Index
  1. Introduction & News Section
  2. Article Section
  3. FAQ Section & Conclusion
Bookmark Article
Download Article
Download this article as a PDF file