WordPress.org

Support

Support » How-To and Troubleshooting » How to remove a widget on a particular page?

How to remove a widget on a particular page?

  • 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • buddha trance
    Member

    @buddha-trance

    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.

    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

    buddha trance
    Member

    @buddha-trance

    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.

    buddha trance
    Member

    @buddha-trance

    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(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to remove a widget on a particular page?’ is closed to new replies.