1

I'm using a child of the twentyten default theme and I want to hide the sidebar on some pages.

What is the solution for that?

4

Actually, Twentyten has a no-sidebar page template already.

before

Modify the template option in the page edit screen:

Template Option

And viola:

After

  • John, how can I increase the page width only for this specific page? – a3mlord Nov 20 '16 at 16:24
1

create a new page template, simply duplicate the current page.php or index.php. remove the following:

<?php get_sidebar();?>

and place a template title at the top of the file

<?php
/*
Template: No-Sidebar Template
*/
?>

Then you can choose that when publishing.

NOTE: This will probably impact on your styles, may need to tweak your stylesheets.

0

You can use conditional template tags on your standard page file template

if( ! is_page('page_name')){ get_sidebar();}

or

if( ! is_page(page_id) ){ get_sidebar();}

You can also pass an array

is_page(array(42,'about-me','About Me And Joe')) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.