When you are building a WordPress website from scratch, sometimes you like to customize how a page looks. One popular way is to create some pages that have no sidebars included. The most common reason for creating a page without sidebars is to create less distractions on a particular page for your website visitor.
Here is a quick video tutorial on how to make a new page template for your WordPress Website. This is kind of advanced stuff so if this is your first time in making a page template, please practice on a test blog or something that is not too valuable. This template code will not work with all WordPress themes, however I have used it on more than 10.. You might have to change the code a bit to get it to work…
Video Showing How To Make a Page Template with NO Sidebars
Here is the PHP code that I used to make this page template:
Template Name: Nosidebar
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id=”post-<?php the_ID(); ?>”>
<h1><?php the_title(); ?></h1>
<?php the_content(‘<p>Read the rest of this page »</p>’); ?>
<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages:</strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>
<?php endwhile; endif; ?>
<?php edit_post_link(‘Edit this entry.’, ‘<p>’, ‘</p>’); ?>
<?php get_footer(); ?>
I made this in a notepad and saved it as nosidebar.php
My No Sidebar Template Did Not Work?
If this code does not work for you, simply go into your own theme and grab the code from a page.php file and paste it into a notepad file. Call it something new. Rename both the file and the template name in the code.
Then simple start by removing this line from the code:
<?php get_sidebar(); ?>