When building a WordPress Website for your business, one of the common things people want to do is to provide a home page that does not look like a blog. The Expand2Web SmallBiz theme automatically provides this for you – a page that tells visitors about your business and provides a clear call to action.
But what if you are using a different theme, or you are using the SmallBiz theme but want to completely customize the page? Or what if you want a home page that does not use the WordPress sidebars?
Well, WordPress custom page templates allow you to do this. I’ve shown how to do this in a previous post and video. But when you do this, all of your content for the page needs to be coded in HTML and included in the PHP file you create for your custom page template.
Wait, there is an even better way…
What if you want the customization that a custom page template provides, but you still want to use the WordPress visual editor to change the content on your page?
Here’s how you do it. You can create a custom page template, but inside the page template you need to include a few extra WordPress functions. This allows you create a page anywhere on your website and then edit the content of the page using the WordPress visual editor!
Here’s the code for the WordPress Custom Page Template
Here’s the code you use for the custom page template. Just copy this code and save it in a file called no-sidebar.php and put it in the /wp-content/themes/smallbiz directory.
<?php
/*
Template Name: No Sidebar
*/
?>
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div style="width:850px !important;">
<?php the_content('
Read the rest of this page »</p>'); ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>
Once you’ve created this file, you can go into WordPress and create your Page, and select No Sidebar as the page template. You will get a page that has the layout and look and feel of your website, without the sidebar. And best of all you can edit the content using the visual editor in WordPress!
I will be including this custom page template by default in the next version of my SmallBiz WordPress Theme coming out in the next couple of weeks.
Note: If you are using a theme other than the SmallBiz theme, this code can still work. You might have to remove the two <div> elements at the end, however.






{ 2 trackbacks }
{ 10 comments… read them below or add one }
Hey GREAT info, Quick question without the side bar how would you put an awebber form like a pop up in the page if you dont have the form on the side bar? Can you do that with a static page minus the side bar? thanks!
Hi Dannah,
The Aweber form is just a chunk of JavaScript code that you include on the page, so you don’t need the sidebar for that. Most themes have a place to put code like the Google Analytics snippet on every page of your site, you can just use that or put it in your footer.php.
-Don
Don, I am using the Chiropractic theme and it does not have the no-sidebar template. I followed you directions and used the code you supplied, and it worked! Thanks a ton. This was very helpful to be able to create a page without the side bar.
Along that same line, could I change the contact template so it does not show the side bar by editing the contact template and adding the no-sidebar code at the end? I would be interested in knowing.
Thanks.
Great post! I love having a blog as my primary site but it’s nice to be able to customise it to give ‘pages’ the look of actual webpages.
Cheers
Really nice but a little confusing for me. I am newbie in wp. My question is though; Can I create a site in photoshop, code it in dreamweaver and then paste in the code between the code you provided above? Is this clear?… kind of confuse…
@JA, Well, no it doesn’t work that way. If you want to design the website from scratch and entirely change the look and feel you would need to create a new WordPress template. What I’m showing here is how to change the page layout within an existing template.
Hello Don,
Ive been searching for a couple of days now and I just found your site (via Vimeo) Fantastic tuts! I was specifically looking how to modify existing pages and still be editable within wordpress. Looks like you have answered my questions.
I still have one more doubt though. I would like to be able to add 3 colums within the page template, at the bottom of the article. Would I need to create the divs in the code? Many thanks don.
Thanks for the great info!
I had a related question about doing a custom page in this way. I want the custom page to be just like every other page except to receive specific post categories under the static content. That is, static content created in WP editor followed by posts of a specific category. I know it can be done but I haven’t had any luck finding the information I need to do it.
Do you have a tutorial for a template like JA asked about? Or do you know where I can find a turorial like that? Where I can create a new WordPress template from a website I made in Dreamweaver.
Love smck112
This is really great thanks! I just couldn’t get the code right myself. Hopefully I might even make some money with this: Abandon the Cube Travel Gear