
A reader, John asked whether it is possible to add an extra page template without any sidebars to the Soothing Theme. Seems like John would like to add a Forum to his site and he would prefer the Forums page page not to have any sidebars. Seems reasonable enough, but in all honesty, I have never found any software that would allow a Forum to be integrated into a WordPress Theme or are there any WordPress plugins that serves this. Most of it will require you to add the Forum Scripts in an individual folder and then point the link to that folder in your blog navigation. The closest thing is bbPress, but it takes some technical know how to get it working. Since I have never tried it, I don’t think I am qualified to talk about it any further.
Anyway, no matter what the uses, a page without sidebars does comes in handy sometimes. You can use it for the About Me page and so on. So without further ado, lets get cracking. Be reminded that, for the convenience of John, I am using the Soothing Theme that I created for this tip. It is a no frills Theme without any complicated codings so it is easier to work with when it comes to customizations.
First of all, we have to add some CSS codes in our stylesheet php to specify how we want the new page template to look. The content area naturally have to be widened to take up the space previously occupied by the Sidebars. So as in any additional stuffs that we want to add into our Theme, we have to create a new div id. For this, I created one called simply, no_sidebar. I set the attributes to these values.
#no_sidebar { width: 800px; padding:10px 10px 0 10px; overflow: visible; float: center; }
The width is decided by how wide is your page. If your page is 1000px you can set your width to 950 px. which will allow some space for paddings on both sides. Then of course you want everything to be centered since there are nothing on both sides.
Next you will have to create a new class id. This wil decide the layout of the page like the fonts, the spacing, the colors and so on. So I created this:
.nosidebar {width: 800px;font-size: 1.4em; line-height: 1.7em; color: #444; float: center; }
Update your stylesheet.
Now we will have to create a new php file. Look for your Page Template php. Copy and paste the all the codes into Notepad. On the top, before anything, add in these codes.
<?php
/*
Template Name: No-Sidebars
*/
?>
This will show WordPress that you have another Template.
Now replace the <div id="content"> with <div id ="no_sidebar">. Replace also the <div class="post" id="post-<?php the_ID(); ?>"> to <div class="nosidebar" id="no_sidebar-<?php the_ID(); ?>"> Lastly, delete the <?php get_sidebar(); ?>
Just to make things less confusing, the whole file will look like this when completed.
<?php
/*
Template Name: No-Sidebars
*/
?>
<?php include('header.php'); ?>
<div id="content_box">
<div id="no_sidebar">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="nosidebar" id="no_sidebar-<?php the_ID(); ?>">
<h2 style="padding-top: 0;"><?php the_title(); ?></h2><br>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
</div>
</div>
<?php endwhile; endif; ?>
</div>
</div>
<?php get_footer(); ?>
Save the file as ‘no-sidebar.php’, without the quotations, of course. Open your FTP client and upload this new php file to your Theme’s root folder where all the other php files are residing.
Go to your WordPress Dashboard. Click Pages – Add New. On your right hand side, under Attributes, Templates, you will see an extra template named no-sidebars in the drop down menu. From now on whenever you want to create a page without any sidebars, just select and use this template before publishing.
Even though the tips above are written based on the Soothing Theme, the steps should be quite similar with most other Themes. You only need to identify the correct codes to replace as other designers have their own preferences.
Related posts:
- How To Add Colors To Your Theme Sidebar There are times when you would like to add some color to your WordPress Theme’s sidebar to make it more unique, especially if you are using a free Theme which many others are using. There are a few ways to go about adding colors to your sidebars. Read more...
- Add Left Sidebar To 2 Column WordPress Theme For a programming noob, how easy is it to add a left sidebar to a 2 column WordPress Theme that has a right sidebar? Not easy. The simple reason is, noobs like me don’t think so logically as compared to someone who has the proper training. So I spent...
- How To Make A Simple MiniSite Template For Those who have downloaded the Seven Dollar Secret you would too have gained access to the 7 Dollar Script. As mentioned before, if you have done some digging on your own, you would have noticed that the script contains all the necessary html template and files which can be...
- How To Edit The 7 Dollar Scipt – Download Page The second template we must edit in the 7 Dollar Script is the download page. If you remember, to sell products in our WordPress blog, we will only be using the direct method. As we are only selling something that will benefit our readers and not doing it as an...
- How To Increase The Size Of Your WordPress Theme Size, in this instance is the size area of your blog layout and not size in terms of traffic, contents or whatever that you deemed as the bigger the better. Some says, ’size does not matter’, what matters is the quality. In this case, size does matter because sometimes, you...












{ 3 comments… read them below or add one }
Worked great! Many thanks.
By the way, the forum plugin I’m using can be found at http://simplepressforum.com/
John
Hi John,
No problem, glad I could help.
Thanks for the link. It’s the first WP plugin that I have come across that lets WP users integrate a Forum into their Theme.
exemplary work. You have gained a new reader. I hope you can keep up the good work and I eagerly await more of the interesting posts.