From Weblog to CMS with WordPress
by John McCreesh04/20/2006
With the advent of blogging software, creating web pages has become so easy that anyone with the most basic computer skills can establish a presence on the web. However, in the best open source tradition, the most popular blogging software is evolving rapidly. In some cases, it is now as powerful as many of the content management systems (CMSs) used to build traditional websites.
This article describes how we used one blogging package (WordPress) to replace a traditional content management system (phpWebSite) to run a community website. As a result, ordinary people in the community can now maintain the site, the site has all sorts of new features such as RSS feeds, and the webmaster can do more useful things (such as hacking WordPress plugins).
Why a Weblog?
For those who have been living on a different planet, a weblog (or blog) is an online diary that contains a series of posts displayed in date order (newest first). In addition, blogging software usually provides an archive mechanism for filing away old posts, permalinks (human-readable URLs for each post), some means of classifying posts, a search engine, RSS feeds, and other goodies. However, the key factor is ease of use for web novices: allowing the creation of web pages using a WYSIWYG editor and without requiring any knowledge of HTML, CSS, FTP, or other acronyms.
There is a wide range of open source blogging software available. WordPress is one of the more well-known and most powerful blogging packages. It runs on a standard LAMP platform and it has a very open architecture, so it is highly configurable by skilled users. However, version 1 was criticized for putting the power in the hands of skilled users at the expense of ease-of-use for less skilled users. WordPress 2, released in the beginning of this year, has gone some way to remedy this, with a decent WYSIWYG editor (TinyMCE) and other immediately available features, such as the ability to upload images (see Figure 1).
After using WordPress to create my blog, I wondered whether it would be powerful enough for a "real" website. I have been maintaining a community website for the Balerno Community Council for more than five years, migrating the content between several platforms, most recently phpWebSite. phpWebSite is a great CMS, but it has proved a challenge for ordinary people using it to maintain content. WordPress looked much easier to use, but would it work as a CMS?
Figure 1. The WYSIWYG editor in WordPress 2 (click for full-size image)
A Better Theme
My first problem was that I have zero graphic design abilities. Fortunately, there are many WordPress themes out there (see Resources at the end of this article). After a bit of hunting around, I found Becca Wei's WordPress themes -- her Almost Spring theme was pretty close to what I was looking for. Although it was a WordPress 1.5 theme at the time, I found it worked perfectly well with WordPress 2.0. With a bit of fine-tuning, I had the look-and-feel I wanted.
Next, I had to make WordPress work like a CMS. The first clue that WordPress might do the job was its support for static web pages. WordPress provides the usual chronological blog posts (called "Posts"), but it also understands traditional web pages (called "Pages" -- there's an original naming convention for you). You can arrange pages in a hierarchy, with child Pages listed beneath a parent. Pages are essentially static; once you put them on the site, they stay there and don't disappear off into an archive. That sounded like a CMS to me.
I now needed to find a way to use one of these Pages as a home page, which would be displayed in a different layout from the other content pages. WordPress supports multiple templates, which it calls a template hierarchy. By default, WordPress uses an index.php template file to display content. However, you can overwrite this when displaying certain types of content, such as archive data or the author's personal profile. The feature I needed was that when WordPress finds a home.php and an index.php, it will use the home.php template instead of index.php whenever a user accesses the root URL of the site. Another problem solved.
The next challenge was creating a home.php that would display only my selected home page. Becca's theme had given me a wp-content/themes/almost-spring/index.php, and copying this to home.php created a starting point for hacking. WordPress helpfully provides a Theme Editor to make hacking possible without having to go through the "FTP it down from the site, edit it, then FTP it back again" routine, but you still have to hack the code (see Figure 2).
Figure 2. Hacking code the WordPress way (click for full-size image)
How it Works
This is how my hack works. WordPress's default index.php template file displays the last n Posts, which index.php receives through a mechanism that the documentation calls "The Loop". This creates a traditional blog. The home.php hack replaces The Loop by a single selected Page. Suddenly, I no longer have a blog -- I have a conventional website.
The hack can be summarized in four easy steps:
- Find a theme and do any fine-tuning
- Design the home page as a Page in WordPress. Give it a post-slug of home. Test that it looks ok.
- Copy index.php to home.php. (Sorry, that's an FTP job.)
-
Edit home.php, and immediately after the first line add in the line:
<?php query_posts('pagename=home') ?>
Related Reading Head First HTML with CSS & XHTML |
Now, when visitors access the home URL, WordPress will display only the Page with a page-slug of home. It's no longer a blog -- it's a website.
- What is a page-slug? If you choose to enable name-based permalinks, WordPress will create a URL-friendly version of a Page title (for example, "My Home Page" becomes "my-home-page"). This is a page-slug. WordPress allows you to overwrite the default with your own pet slug if you so desire.
- What is
query_posts
?query_posts
is one of the many WordPress template tags, which bridge the worlds of the HTML designer and the PHP hacker. Please read the documentation for more.
Once I had the home page sorted, designing the rest of the community site was comparatively straightforward. The site contains about a dozen pages of general information, which are WordPress Pages, and also snippets of local news and minutes of meetings going back eight years, which are now WordPress Posts. It's a nice twist that WordPress was originally designed to manage Posts, with Pages as an afterthought. In this community site, the main content of the site is Pages, but it also makes good use of Posts.
Could WordPress be used for full-blown websites as well as blogs? I believe the answer is definitely yes. WordPress lets users do an awful lot of things without requiring any knowledge of the underlying technology, such as maintaining content, including images; creating categories for the content; selecting the look-and-feel of the site from a large and growing range of templates; managing multiple users with different access rights; and adding and removing plugins for extra functionality. For users with a working knowledge of web technologies such as HTML, CSS, or PHP, then so much the better -- they can dive under the bonnet/hood (depending on which side of the Atlantic you dive from) and work all sorts of magic. The end result is the best of both CMS and blog worlds, with flexible content layout arranged under hierarchical menus such as a CMS, plus all the nice features of blogs such as ease of maintenance, RSS feeds, comments, and permalinks.
Resources
The definitive reference source for WordPress is the WordPress Codex.
The Wordpress Support Forums are full of helpful people.
There are many sites with downloadable WordPress themes, such as Theme Browser and Alex King's Theme Browser.
There are also hundreds of WordPress plugins available. If you're just starting with WordPress 2, the safest place to start is the list of WordPress 2 compatible plugins.
John McCreesh spent a lifetime in commercial IT before discovering open source during the dot-com boom.
Return to ONLamp.com.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 17 of 17.
-
No Programming
2007-12-16 06:22:33 theerasers [Reply | View]
Instead of writing complex server code or fumbling with vulnerable client-side "JavaScript Password Protection" schemes, this program offers an inexpensive online solution that lets you simply copy and paste customized code snippets to protect any of your web pages.
You could try to use JavaScript to keep your pages secure, but any visitor could bypass that in a few minutes. One need only turn off Metas and turn off JavaScript in the browser to gain entry! Beware of competitors' systems which utilize this flimsy technique to protect your pages.
Using this software, you can effectively keep your pages private. It's because this program functions "server side" using scripting language. (In simpler terms, that means your pages are secured before they're even delivered to the browser). Yet there's no server modifications or program installations necessary.
If you know how to edit your web pages then you already know how to use this software!
If you need more info. about this program email me at webmaster@newcreditfilesfordummies.com and I'll send it asap.
-
You should check out Graffiti
2007-12-08 13:11:58 RobHoward [Reply | View]
We built Graffiti based on all the people that we heard from that wanted the simplicity of WP with the features of a CMS.
http://graffiticms.com
-
Wordpress as CMS
2007-11-15 19:44:36 ARwebConsulting [Reply | View]
Check out our new website, it was the first time we tried using wordpress as a CMS with a bit of php hacking and plugin research; the site turned out quite well.
-
Thanks
2007-07-17 11:31:44 Videolar [Reply | View]
very good documentVideolar (http://www.izlesek.net)
-
Flare9.com (wordpress driven site builder)
2007-02-21 18:18:56 jstrebel [Reply | View]
Hey folks, we just launched in private testing a sitebuilder driven by wordpress 2.1. We have automated the plesk account creation, webmail, domain reg, and wordpress install for the client. We have also done some plugins to hack the wp-templates and tinymce to expand the functionality of the editor to allow for multiple page layouts, and editable regions per page.
Should be launched live soon, have a look at http://flare9.com
Thanks
-
CMS
2006-12-28 00:31:39 zillionclix [Reply | View]
I'm definitely trying Wordpress as CMS. I've invested a lot of time in using Joomla, but its just too slow once you add all those plug-ins.
notesanywhere (http://www.notesanywhere.com)
-
.
2006-10-17 07:35:02 JasonHolden [Reply | View]
I stumbled across this posting by accident while researching an alternative to my static website. I am already a guest blogger no The Small Business Blog here in the UK and from that knew I wanted a blog on my site.
As I used a WYSIWYG editor to do and maintain my own site I wanted the same ease of use when changing my site and I wondered about using Word Press to do this and now I know the answer, I will use Word Press and design my site in the manner you have suggested in your posting, thank you, you have saved me a lot of wasted time wondering should I or shouldn’t I.
Jason
-
WordPress works great as a CMS
2006-04-24 13:00:06 drron [Reply | View]
I have used Zope/Plone and Drupal for CMS in the past. With the release of WordPress 2.0, I am ecstatic about the endless possibilities for making my life easier and more productive.
Watch out when you pick out a theme. I picked a very cool looking theme called Iridium for one of my sites and it just keeps switching back to the default theme.
I love the widgets plug-in and the easy controls it gives me. But, be sure to use a Kubrick based them, or you may have difficulty getting stuff to work.
-
great solution
2006-04-21 11:28:21 jlz113 [Reply | View]
I have been using WordPress as a CMS for a few sites now and have no complaints. There are plenty of plugins (http://wp-plugins.net/) and the community is great. Here are the plugins that I use for my WordPress CMS install: http://www.jappler.com/archive/2006/01/11/japplers-wordpress/ -
great solution
2007-03-27 12:55:11 jlz113 [Reply | View]
Updated link: http://www.jappler.com/blog/archive/2006/01/11/japplers-wordpress -
great solution
2008-02-05 02:35:44 Alex_Gibert [Reply | View]
I've invested a lot of time in using Joomla, but its just too slow once you add all those plug-ins. Thank you for this useful stuff. -
great solution
2008-02-05 02:49:43 Alex_Gibert [Reply | View]
Now I'm using WordPress
-
Another plug-in that is helpful
2006-04-21 10:31:14 idano [Reply | View]
This plug-in is also helpful to setup WordPress a CMS. It is called the Category Posts Plug-in.
What it does is allow you to display post titles for a single category in your sidebar.
The use for this is that you can have a "News" section and have just the posts for the category "News".
You can also use it multiple times for multiple categories (news, projects, resources, etc).
Here is the link - http://watershedstudio.com/portfolio/software/wp-category-posts.html
WordPress is great as a CMS.
-
The is a plug-in that will do this for you.
2006-04-21 10:25:35 idano [Reply | View]
I have used WordPress as a CMS on a couple of sites and there is a plug-in that will make a home page for you.
Here is the link for the plug-in -
Static Front Page Plug-in (http://www.semiologic.com/software/static-front/)
-
Easy to modify with little php knowledge
2006-04-21 04:04:57 Silkjaer [Reply | View]
I have used WordPress for ages - for my personal blog. Some time last year it happened I found out the ease to modify WordPress and make plugins, so I started playing around with it, and today I'm running two websites where i use WordPress more as a CMS than a blogging tool: http://webdesignbook.net and http://webdesignbook.net/themes
My personal blog, using WordPress is http://theundersigned.net
but, I think that the themes is the most important when you build a CMS using WP.
You alos can find some softwares in myblog.
http://www.xwand.com