WordPress as a CMS

After wading through a headache-inducing number of Codex pages, and muddling through various articles which briefly touch on using WordPress as a CMS but don’t actually provide clear instructions… I decided to write my own version of how to do it.

Powering your entire site with WordPress can be done with a minimum of configuring, while still affording you the ability to maintain a tidy file structure, by installing WordPress to its own directory). This way, your blog “virtually” exists in the root, allowing you to create static pages and offering control over the site-wide content you develop.

Update: This is not an article on how to hack WordPress into a full-fledged CMS. It was written long ago and targeted version 2.0. It remains mostly for posterity. Please note I also removed a large portion of the original tutorial because the release of WP2.1 made the info obsolete.

Installing WordPress Into its Own Directory

  1. Create a folder in your file structure where you want to install WordPress. Unpack and FTP all files into that folder.
  2. Navigate to the new folder in your browser and follow the prompt for setting up your database and logging in
  3. Once logged in, go to Options > General and make sure the address currently in the box labeled WordPress address (URI) matches the name of the folder you installed to, for example http://whatever.com/yourblog
  4. Change the address currently in the box labeled Blog address (URI) to reflect your root – http://whatever.com
  5. Save your changes
  6. Still in Options, go to the Permalinks tab, and change the structure to whatever you prefer. I typically use /%category%/%postname%/
  7. Note: The purpose of changing permalinks at this point is to force the .htaccess file to show up in the remote file structure, where it would normally be hidden (even if you have “show hidden files” selected in your HTML editor prefs)

  8. Download .htaccess (thereby forcing it to be visible on the local side as well)
  9. Copy index.php and .htaccess from your blog root to the site root.
  10. Open index.php and insert the folder name of your blog just before the slash (/) so it reads:
    require ('./whatever/wp-blog-header.php') ;
  11. You should now be able to navigate to your site root http://whatever.com, and see your blog content, rather than a static front page.
  12. Note: Be sure you don’t have something like index.htm in your root, which would override index.php.

So now you should have a shiny new WordPress installation set up and ready to customize. Before we dive in to actually using it as a CMS, let’s cover a few  basics. There are two means of displaying content with WordPress – Pages and posts. Pages operate outside the the Loop. In other words, they don’t age and they’re usually accessible as part of the main navigation. They’re used for displaying static information such as a contact form, bio, services, etc. Conversely, posts are dynamic pages which will “age”, or move down the blog chronology as new entries are made.

Page Control

The number and type of pages which can be added using custom templates is virtually limitless. Say you want to showcase your Portfolio. You might need a layout vastly different from your standard pages, especially if you’ll be displaying large images. The easiest way to accomplish this is to duplicate page.php, rename it to portfolio.php, and style to fit the needs of your content. Finally, add the following to the top of your page (before any other code):

<?php

/* Template Name: Portfolio */

?>

FTP your new template and log in to your control panel. From within the Pages admin panel, create your page. I know this seems redundant, but WordPress needs to reference it somehow. Add your content (either from within your HTML editor, or via the Write box within WordPress) and assign the page to the ‘Portfolio’ template using the drop-down selector on the right.

Post Control

Using the Loop, you have extensive control over how and where your posts appear. You can create custom styles by category, single post, or even by manual posting. For example, the index page of a typical WordPress site features the most recent post(s), ordered by date. If you want only certain entries to appear on the front page, you can specify this by modifying the Loop in the home.php or index.php file.

Further Considerations

  • Comment Control – for every forum, blog or community portal, there needs to be a way to moderate. In time, you may need to employ the use of some comment moderation and/or anti-spam tools.
  • User Management – User roles may not be a consideration for you yet, but if you ever plan to have multiple authors or users, you’ll have to implement some restrictions.

Well this wraps up my first attempt at writing a custom WordPress installation guide. :) If you notice that I left anything out or completely botched something up, please let me know so I can make corrections!

This post is tagged: ,


5 Responses to “WordPress as a CMS”
  1. Bohonyi Balazs
    12.11.2007

    Thank you for these articles. I am new to WP, read a lot the codex and just needed some advices and examples to set up WP as a CMS. You really helped me a lot with these series of articles about WordPress as a CMS.

  2. 04.20.2008

    Thanks for clarifying the codex – its endless. I have been using WordPress for some time but am about to embark on using it as a CMS for a client, your articles are making things a lot more straightforward. Cheers.

  3. 04.28.2008

    thanx for the info
    using it to create a static page for my blog

  4. 08.15.2008

    I’m early in the process of building a 75 page site with WordPress. When I started building out my pages I noticed that the Manage->Pages interface does not have ‘categories’ like Manage->Posts. My navigation is going to be custom/fixed so I don’t have to worry about articles/content fading over time. I also want my pages to have url.com/category/pagename which it doesn’t seem like Pages can do since there’s no category. Might I want to just use Posts for all my pages so I can categorize them?

  5. 08.15.2008

    Never mind. As usual, a little more searching uncovered a plug-in the does exactly what I needed to to. : ) It’s called “Page Category Plus” and works like a charm. Supposedly not being rev’d but hopefully somebody picks up the reins, and if not a similar one will come along I’m sure.