WordPress.org

Ready to get started?Download WordPress

Forums

How to remove a widget on a particular page? (5 posts)

  1. mike365
    Member
    Posted 4 years ago #

    How do you remove the actual widget area (not the widgets within the widget area) on a particular page using the page number. I have a page that I installed the Simple Press Forum on and the right widget is not needed since I want the forum to be displayed across the entire page. That's why I need the actual widget area to be removed only on that page.

  2. buddha trance
    Member
    Posted 4 years ago #

    You can create a template for a page with no sidebar and assign that template to the forum page

    Make a copy of page.php of your theme, and rename it page-nosidebar.php

    1 - at the very top add

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

    2 - remove the <?php get_sidebar(); ?> part.

    On the forum page, edit the attributes, and select "No sidebars" as your template.

    Hope this helps.

  3. mike365
    Member
    Posted 4 years ago #

    I'm not familiar with creating pages for wordpress... Is the entire .php file just have:

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

    because you then said to remove the <?php get_sidebar(); ?> part.

    where is the <?php get_sidebar(); ?> part.

    Thanks,

    Mike

  4. buddha trance
    Member
    Posted 4 years ago #

    It should be in the duplicate you made of page.php

    page-nosidebar.php

    <?php /*
    	Template Name: No Sidebars
    */ ?>
    
    the same code of page.php here
    minus the get_sidebar call

    file goes in your theme folder.

  5. buddha trance
    Member
    Posted 4 years ago #

    example of no sidebar template from the Default theme:

    <?php /*
    	Template Name: No Sidebars
    */ ?>
    
    <?php get_header(); ?>
    
    	<div id="content" class="narrowcolumn" role="main">
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    			</div>
    		</div>
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    	</div>
    
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic