Using WordPress as a True CMS
This is true, WordPress can be put to use for a wide variety of websites, whether it be a local community website or, especially with the help of WPMUdev.org, a fully-fledged social networking arena.
However, there are a few things that you can do to truly revolutionize your website, and to make it much more of a CMS than is currently available via most themes, and that is what this article is all about.
This has been written for those who are new to WordPress, as well as seasoned users, so there will be certain things here that may be obvious to many users, such as how to use a nicer permalink structure or create a page template, but just skip those sections, as there may be a hidden gem here that will give you that excited feeling we get, and have you rushing off to test some code. For those of you looking to branch out form the norm, take a look, and this may give you some pointers.
Changing Your WordPress Permalinks
They really don’t help with your Google rating at all, and that is something that should make you rush to make changes.
I always use the following format, and believe that this is what many others use also:
To do this, go to Settings>>Permalinks & select the Custom Structure, and type in:
This structure is fine for smaller blogs but may cause performance problems with larger sites. To find out more about this, take a look at this article.
How To Set a Static Page in WordPress
This is why you may want to consider using one of your pages as the home page instead of the traditional one.
To do this, go to Settings>>Reading and select the page that you would like to use as your home page.
Creating Page Templates in WordPress
To create a different look for different pages, you just need to create new page files, which can then be uploaded to your main theme’s folder and selected from a drop-down menu whenever a page is created or edited.
The easiest way to do this, is to edit the current page.php file, and make your changes to it, save it under a different name, such as page2.php, and then select it if you want to use that design.
Of course, it would be best to name it something more descriptive, especially if you create a variety of different templates, as you will then know where you are when editing pages.
At the top of the new template page, you will need to have the following:
Template Name: YOUR TEMPLATE NAME
Creating Category and Post Templates in WordPress
There are ways to create a different look to various categories by hard-coding, but there is a much simpler way, and that is by using the Idealien Category Enhancements plugin.
Not only will this allow you to have a different look to the category.php page but, depending on the category you are in, it also allows you to have a specific look to all posts in a certain category/sub-category.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
This involves adding code at the top of each edited category page, in the same way as with the page template above. This code is:
Category Template: Custom Template Name
I have found that the section of this plugin that deals with linking in your seperate single.php files does not always work correctly, as it doesn’t seem to call the seperate file.
If this happens, then don’t panic, as there is a plugin that deals with this very nicely.
The Single Post Template plugin allows you to easily add as many templates to your create/edit posts section of admin, and you can then select the template you wish to use for each post. This is probably a much better way to deal with it if your posts are in multiple categories, as you get to choose which template to use.
Simple Redirection in WordPress
If you want to have full control over your menus, enabling you to link easily to posts or external links from a page menu, this is very simple to do, with very little editing.
Open your page.php file, and find the following:
<?php get_header(); ?>
Change this to the following:
global $post; // < — globalize, just in case
$field = get_post_meta($post->ID, ‘redirect’, true);
if($field) wp_redirect(clean_url($field), 301);
Once you have done this, you can create a simple redirect by creating a new page and using the custom fields section.
Value: FULL URL TO WHERE YOU WANT TO REDIRECT
Showing Alternate Headers on your WordPress Pages and Posts
If you want to show different headers, depending on which part of your site users are on, you can do this by replacing a single line of code.
Find the following line of code in a file such as page.php, single.php, category.php, etc:
<?php get_header(); ?>
Replace this with this code:
<?php include (‘ALTERNATEFILE.php’); ?>
Calling Alternate style.css files in WordPress
So, you have a different header for various sections of your site, but the CSS is all the same. Why not have a seperate CSS file for different areas of your site?
Again, this is done by simply replacing a single line of code.
Find this code (or something similar):
<style type=”text/css” media=”screen”><!– @import url( <?php bloginfo(‘stylesheet_url’); ?> ); –></style>
Replace it with this code:
<link rel=”stylesheet” href=”/wp-content/themes/imwp/style2.css” type=”text/css” media=”screen” />
I am currently working on a website that includes all of these methods, so why not take a look at it and see it in action:
These are the two plugins discussed above, in the category/post/page templates section.