I wanted to display the Forum on a page with no Sidebars which at first I thought was going to be a bit tricky but to be fair its turned out to be pretty straight forward.

I just needed to create a page template and apply it to the page that was going to display the Forum.

To do this I made a copy of page.php which is located in the current themes directory and saved this copy as  page-nosidebars.php.I then deleted all the code in this file and replaced it with

<?php /*
 Template Name: No Sidebars
*/ ?>

<?php get_header(); ?>
 
 <div id=”primary” style=”width:920px;”>
  
  <?php if(have_posts()) : ?>
  
  <?php while(have_posts()) : the_post(); ?>
  
  <div id=”post-<?php the_ID(); ?>”>
   
   <h1><?php the_title(); ?></h1>
   
   <div>
    <?php edit_post_link(‘Edit’, ‘[‘, ‘]’); ?>
   </div>
   
   <div>
    <?php the_content(); ?>
    <?php wp_link_pages(‘before=<p><strong>’ . __(‘Pages:’) . ‘</strong>&after=</p>’); ?>
   <div></div>
   </div>
   
  </div><!–.entry–>
  <?php endwhile; ?>
  <?php endif; ?> 

 </div><!–#primary–>

<?php get_footer(); ?>

Once saved this becomes available from the dropdown menu of Page Templates when writing a new page.Now I can create pages and select this template when I do not require sidebars.

Tags: