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.







{ 19 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
Very nice, thanks.
A quick question: My menu is at the bottem of the page, not at the top. When I apply your code, the menu also disappears. How do I fix it so that the menu stays and only the sidebar disappears?
@Noa – It’s hard to say without looking at your site. What theme are you using, and what is your website URL?
@Don – the site isn’t ready yet. It’s: http://www.nafrtiti.com
that will be the main page. Since the menu bar disappeared, it’s not linked to the rest of the site. To view the rest go to: http://www.nafrtiti.com/myblog
I’m currently changing the template to Hebrew, so the site is a mixture of both right now. But you’ll manage to navigate, I’m sure.
Hi Don,
This is great! Thank you.
Question: I created simple custom page, but now I’m not able to use any widgets. Is there a way to enable widgets so they appear on a side bar?
Hi Don,
I found that php code for no-sidebar was already installed with my theme so good to go there. Did a new page with no sidebar. Great so far. But when I completed the SmallBiz Theme options when I initially loaded the theme, it automatically generated a home page and I don’t know how to get rid of that so I can use the no-sidebar version of the home page I created. The auto-generated one is not listed in the “pages”. How do I replace what the theme auto-generated with my new home page? If I name my new page “Home”, I just get two tabs that say “home” and I have BOTH. Help!
Elizabeth:
You can watch this video http://www.expand2web.com/blog/video-wordpress-home-page/ at about 3:30 minutes Don will show the steps.
Here are the steps:
1) Create your new Hompage in Wordpress using Pages -> Add New
2) Visit the Smallbiz Options Panel and “Omit: the new Page from the Nav Menu
3) In the left dashboard sidebar click “Reading” under the Settings tab
4) Set “Front page displays” to “A static page” and select your Home page from the drop down menu. It is important to leave the “Posts page” setting on default which is blank or -Select-
Thanks Thomas! I followed your steps and it works – much appreciated!
Hi Don,
Do I have to download Wordpress 3.o first from Wordpress.org in order to custom the page w/o side bars? I am working on a blog from Wordpress.com. Would this work for the blog I created on Wordpress.com?
Thanks much for your help!
@Gloria – Unfortunately you can’t do this with WordPress.com site. You would have to download WordPress 3.0 from WordPress.org.
{ 2 trackbacks }