Paul Tan's Automotive Industry News

Faking Multiple Templates with Wordpress

Unlike other blog software like Movable Type, Wordpress uses a single template system which might be a blessing or a boon to people. Some people find it easy to use, and some people find it over-simplified. It makes it hard to have different looks for different sections of the site. For example, having the sidebar on the main page but not on sub-pages. Here’s how to covercome that.

if ($single) {
// individual post contents
} else if ($cat) {
// categorical listing contents
} else if ($m) {
// monthly listing contents
} else if ($year) {
// yearly listing contents
} else {
// main page contents
}

It involves the use of Wordpress built in boolean values, which are $single, $cat, $m and $year. The above code is the basic idea how to make use of the booleans to display different content in each type of page.

Tips are courtesy of ElasticDog. Visit the reference for some detailed examples on how to implement this.

Reference: ElasticDog

No comments yet.

previous post: Proton Savvy TUV Audit
next post: Proton Savvy Launch at 5pm Today!

Leave a Comment

You must be logged in to post a comment.

Don't have an account?

If you do not have an account on paultan.org, please click here to register. Note that first time commenters will have to be approved before your comment appears.

Please do not submit your comment twice, the system has accepted your comment, it just needs to be moderated first. Once your first comment is approved, all subsequent comments will show automatically.

What are you waiting for? Register now!