Using Wordpress to build websites as a CMS

Wordpress is my favorite blogging platform, and until fairly recently that’s all I thought it was, but these days I build entire websites using the Wordpress platform. Whether it’s a simple static brochure site, a ’sales letter’ product site, a review sites or anything else, Wordpress is so versitile that it can be used for just about anything. There are many advantages to using Wordpress over a more traditional approach to creating sites – it’s easy to setup, even for non-techies, you can maintain your site from anywhere, it’s great for SEO and best of all it’s free!

Since Wordpress is a blogging platform, there are a few tweaks that need to be made if we’re going to build successful sites with it. Here is my method, step by step, for creating great looking, effective sites that are suitable for your Internet Marketing business.

Using Wordpress as a CMS

Download and install Wordpress

OK so this step is pretty simple. Head over to Wordpress.org and download the latest version. Once you’ve done that, unzip it create a database on your server. If you have a web control panel (like cPanel or DirectAdmin) then create a new MySQL database and jot down the details, if not don’t worry just ask your hosting company for one and they should email you with some login details and a database name.

Next you’ll need to edit the file wp-config-sample.php with details of your database. Use Nvu or Notepad (or similar) and edit the following lines:

define('DB_NAME', 'Your database name goes here');
define('DB_USER', 'Your usernamename goes here');
define('DB_PASSWORD', 'Your password goes here');

You should also change the line:

define('SECRET_KEY', 'Type anything you want here');

Everything else should remain the same, although if for any reason you have a problem check with your host that the DB_HOST should be set to localhost (Will be correct 99% of the time!). Save this file as wp-config.php

Once you’re done, upload the whole lot to your server (the root directory, assuming you’re using Wordpress for the entire site). Now you need to run the installation script so point your browser at yourdomain.com/wp-admin/wp-install.php

Wordpress instalationYou’ll see the Wordpress welcome screen which will prompt you for your Blog Title (title of your site) and an email address. Fill these out and click Install Wordpress.

Next you’ll see a success screen telling you that Wordpress has been installed. It will give you your default username, admin, and a temporary password. Write the password down carefully, or copy it to the clipboard (it is a randomly generated password and without it you can’t login!) then go to yourdomain.com/wp-admin (this is the URL you’ll use every time you want to maintain your new site) and login with these details. Now before you do anything else, click on admin and change your password!

Make files and directories writeable

CHMOD Wordpress File permissionsIn order to make updating your site as simple as possible, you’ll want the ability to upload images and make changes right from within the control panel. In order to do this, certain files and folders on your server need to be given the right permissions. Fire up your favourite FTP client (I use AceFTP) and connect to your site. Next make .htaccess and /wp-content/uploads writeable by giving them a CHMOD value of 755 (in AceFTP right click and select properties). Do not set 777 as this is a potential security risk. This allows Wordpress to make necessary changes to these files. If you want to use the theme editor in Wordpress then set the same permission to your theme directory (/wp-content/themes).

Note 1: Depending on your server configuration, 755 may not be enough to allow Wordpress to write. While the Wordpress documentation suggests CHMODing to 777, I would suggest otherwise as it is a potential security risk, basically allowing anyone to upload anything to your server. You would be much safer uploading changes manually via FTP

Note 2: By default, many FTP clients have .htaccess as a hidden file and you may need to allow hidden files from properties before you can see and edit it!

SEO friendly URLs

Wordpress is great for SEO, but it needs a little tweak. Login to your admin control panel and select settings from the top menu, then click on permalinks. By default, URLs on your site will have the format:

http://www.yourdomain.com/?p=123

but what would be much better for SEO purposes would be:

http://www.yourdomain.com/category/postname

so that’s what we’ll do. Select custom structure and in the box enter /%category%/%postname%/ then click Save Changes. If you set the permissions of your .htaccess file above OK you’re all done, if not you need to copy the code which you’ll see at the bottom of the page into .htaccess and upload it. Now your URLs will be much better looking, and include your keywords!

Static front page, with separate blog

As a blogging platform, the index page (homepage) of your site will, by default, display the most recent posts in reverse chronological order. If we’re not running the entire site as a blog we want more control than that so here’s what to do…

First, create a new page (in the control panel go New > Page) as opposed to a post, call it Home and enter whatever information you want (text, images, links, whatever…) and create another new page called blog (or news). Now go to Settings > Reading and change the settings for Front page displays. Select static page, and set the front page to the new home page you just created, and posts page to the new blog page. What you now have is a homepage which you can have total control over, and a news/blog section which shows all your latest posts on the new blog page!

Conditional tags (advanced users only!)

If you don’t mind getting your hands dirty with a little PHP coding there’s one more very useful feature of Wordpress which I want to mention – conditionals. These are really useful when you’re working on a dynamic theme as they allow you to control what content is displayed on different pages. For example, you might not want a title on your homepage (so instead of ‘Home’ you can set it to whatever you want in the HTML instead) or you might want all pages in a specific category to have a submenu.

Here’s an example of how to use them. To display a different <title> tag based on which page is currently being displayed try this:

<title>
<?php
if (is_home()) {
        echo bloginfo('name');
} elseif (is_404()) {
        echo 'Error - 404 Not Found';
} elseif (is_category()) {
        echo 'Category:'; wp_title('');
} elseif (is_search()) {
        echo 'Search results';
} elseif ( is_day() || is_month() || is_year() ) {
        echo 'Archives:'; wp_title('');
} else {
        echo wp_title('');
}
?>
</title>

As you can see conditionals like is_home() and is_category(’reviews’) can be very useful in making your site more dynamic. If you’re not at all familiar with PHP or coding, or the above code scares you don’t worry – just ignore it, but in the back of your mind remember that Wordpress allows you to change content based on page type. That way if you get someone else to modify your theme you can ask them to do it for you!

So there we go, in no time at all we have a complete site based on the Wordpress platform. Of course, there are loads more features and tweaks but this is a great start. Tomorrow I’ll go through some of the best plugins for an Internet Marketer so you can really get the most out of your Wordpress site.

Subscribe  

18 Comments so far »

  1. Niche Content said,

    Wrote on August 5, 2008 @ 5:26 pm

    Nice info. What about the sidebar? I think getting rid of that on the pages and single posts would go a long way toward making it not look like a blog.

  2. admin said,

    Wrote on August 5, 2008 @ 6:42 pm

    Very good point, and fairly easy to do. There are a couple of different ways to do this depending on the theme you’re using but basically the sidebar is called with:

    < ?php get_sidebar(); ?>

    So delete, or comment out that line from the page.php file in your theme which should remove the sidebar from pages (but leave it for your blog posts!)

    You’ll also probably need to edit the stylesheet to increase the width of the main page wrapper so that the content fills the width of the page! It may be called page, widecolumn, mainwrapper etc - just look for a value roughly equal to what your width is currently set (probably somewhere between 450px and 700px, or 60% to 85%) and edit accordingly.

    Alternatively, keep the sidebar but edit it so that instead of showing catagories and blogroll etc. you can replace it with a menu, or other content of your choosing. Just edit sidebar.php and replace everything between the main < div > tags with your new content!

  3. 12 top Wordpress plugins you need as an Internet Marketer or Blogger said,

    Wrote on August 6, 2008 @ 1:41 pm

    [...] is a fantastic blogging platform, and as I showed you yesterday, it can be a great CMS platform too. Wordpress works great as it is, but one of its greatest assets is how extendable it is. There [...]

  4. Dave Barry said,

    Wrote on August 8, 2008 @ 11:00 am

    I didn’t realise Wordpress could do this. I’ve tried using Joomla in the past and found it too complicated. Thanks for the tutorial, I’m going to try this myself. Can it have multiple users like a proper CMS?

    Cheers, David

  5. Driving traffic through niche social bookmarking sites said,

    Wrote on August 9, 2008 @ 1:00 pm

    [...] to lose, I decided to give it a try and submitted the article I had just written about using Wordpress as a content management system. I really wasn’t expecting much, but within a couple of hours I started to see a small but [...]

  6. Steve Mullen said,

    Wrote on August 11, 2008 @ 3:48 am

    Niche,

    I just finished a medium sized build out of my business website using WP. The way I found to get around the sidebar issue is to use different templates for various pages. First off, I think the best way to go is to eliminate the home.php template if your theme comes with one. The reason for this is that if it exists, by default your designated home page (the one you set in the WP admin as the home) and your designated blog page will BOTH use that home.php template. If you eliminate it, the blog will default to using index.php as its template, and you can designate a template for the home page. Then, if you want to set different templates for different pages, you can build them with different headers, sidebars, etc.

    The only downside of this approach to having different sidebars is that you can’t use widgets on ALL of your pages … just one. What I did was eliminate the code for including widgets on all but my blog page. Then, I just included in the templates whatever I wanted to put on the sidebar on other pages. The non-blog pages all have the same thing in my case, so it wasn’t a big big deal.

    Check out my site - EndGame Public Relations and look at the home, podcast, and blog pages. The headers are different for all three, and the blog sidebar is made to look like the sidebar for .. well .. a blog.

    Steve Mullen

    PS - Now that I’ve typed this here, I really need to get off my butt and write my own blog post on this topic!

  7. Steve Mullen said,

    Wrote on August 11, 2008 @ 1:17 pm

    That’s funny. I thought I posted a link to my blog post about my experiences with Wordpress as a CMS, but I don’t see that comment here anymore. I hope Bill didn’t delete it, since he posted a link on MY blog. Maybe I thought I posted it, but I didn’t.

  8. admin said,

    Wrote on August 11, 2008 @ 1:42 pm

    Thanks for your comments Steve, and some useful info in your post. Not sure how many comments you left but the one above is showing OK.

    Anyway, thanks for dropping by and the useful links!

    Bill

  9. Steve Mullen said,

    Wrote on August 18, 2008 @ 10:42 pm

    Hey Bill — Maybe you can help out with this. I’ve run into a roadblock I can’t seem to figure out. Do you have an idea on how to set to blog page with a different page title as my home page? I’m using All in One SEO Pack, but even disabling it, it seems to be unavoidable that my blog page will have the same title attribute as my home page. I’m stumped. I’m using page.php as the template for my home page, and index.php as the template for the blog. Each have their own custom headers.

    Steve

  10. admin said,

    Wrote on August 19, 2008 @ 10:11 am

    Hi Steve

    A little tweak to your header file will do the trick.

    Since every other page in your site is considered a PAGE (when you’re running WP as a CMS) and this one is not (since it’s your blog) you can use is_page() to check whether this is what is being called. However, that on it’s own would also change the titles on single posts so you need to combine it with is_post().

    So here’s what to do:

    In header.php find this line (or a similar line if your theme has this edited):

    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>

    Now replace it with something like this:

    <title><?php bloginfo('name'); ?> <?php if (!is_page()&&!is_single()) {echo "News and updates"; } else if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>

    Change ‘News and updates” to whatever your title should be!

    As you can see, it checks the page and if it’s not a page AND it’s not a single post, then it must be your blog page and therefore changes the title!

    Obviously you can choose whether the bloginfo(’name’); is within the conditional or not to your own preference.

    You can use the same method to change the way your titles show in single blog posts too!

    Hope that helps,

    Bill

  11. Carol said,

    Wrote on August 27, 2008 @ 12:59 pm

    Hi Bill,

    I need a multi user blogging application - what do you recommend? I’m looking at Compendium, Typepad, and what about Wordpress… have you used the wordpressmu version? Has anyone out there?

    Does Wordpress sell tech support for their MU version, do you know?

    Thank you - Carol

  12. admin said,

    Wrote on August 27, 2008 @ 1:08 pm

    Hi Carol

    I don’t have any experience with WP MU I’m afraid. I’ve only heard good things about it, and since it’s based on the standard WP code I believe virtualy all plugins etc. are supported but other than that I wouldn’t like to advise. I believe that commercial support is available from http://automattic.com/services/support-network/

    Hope that helps

    Bill

  13. Ashley said,

    Wrote on December 28, 2008 @ 10:49 am

    Hi

    Whats the code to include in the htaccees file’ at the bottom of the page’ to setup the permalinks.

    I have set the htaccess to writable and then added /%category%/%postname%/ into the permalink custom field but it return a can’t find page 404 error.

    My HTaccess file is empty at present.

    Any help would be great, no-one is willing to even reply to my qusetion on the WP forum, so you might be my last hope.

    Thanks

    Ash

  14. Bones said,

    Wrote on January 7, 2009 @ 5:20 am

    Is there a method to use WordPress as a CMS for an external site? As in, I develop the site and then connect to the WordPress database and display the information much like WordPress does? That way administrators can simply log into the WordPress blog, write a new post and that information will display on the site I develop if they have ticked the appropriate boxes.

    I look forward to hearing from you.

  15. ganesh said,

    Wrote on February 27, 2009 @ 6:44 am

    hai
    i create a homepage using wordpress.and next i have given links i don’t know the code once the link is clicked the page displays on the same page help me

  16. admin said,

    Wrote on February 27, 2009 @ 7:19 am

    Hi Ganesh

    Did you update the permalink structure? Go to your control panel, settings, permalinks and set a custom structure with this:

    /%category%/%postname%/

    Now when you write and save a new page you’ll see the new URL appear a the top of the editing page… that is what you link to in order to reach that page!

    Hope that helps.

    Bill

  17. ganesh said,

    Wrote on February 27, 2009 @ 11:44 am

    hai admin

    i modify the permanent structure.but it didnot displays the page In li tag it is correct or not please tell me
    bye

  18. ganesh said,

    Wrote on February 27, 2009 @ 11:58 am

    display the dynamic content on the same page what is the code

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: