hide sidebar on pages?
-
How do hide the sidebar on some of the pages? or hide some widgets on the pages? is it possible? as i just want the my blog page to show the categories and archive widgets.
Regards Darren
-
If you want to get rid of the sidebar on some pages you’ll need to make another page type.
I have one I call “blank” and it doesn’t have a sidebar. Just the header, content, and then the footer.
I copied the default “page” template in wordpress, gave it a new name (blank.php) and then added this to the top of the file
<?php
/*
Template Name: blank
*/
?>Look in there for something about sidebar. In my file it said:
<?php get_sidebar(); ?>Delete that line.
Save it. Upload it back to your theme.
Then when you go into the WordPress admin to Pages > edit select your page. Look for Page Template. There should be a dropdown. You want to select blank. Save and view your page.
Hope that helps.
Or you can use conditional comments in the sidebar>
<?php if (is_page('about-me')) { ?> widgets code <? } elseif (is_page('8')) { ?> widgets code <? } elseif (is_page('blog-page')) { ?> <? } else { ?> <? } ?>Is your blog page an actual page, or the default blog page? If it’s default then you’ll want to declare your pages first, and let the } else { part define what shows on the blog page. If blog is a page then just fill in it’s ID or slug in one of the elseif’s
thank you both for your comments but i think i would try the conditional comments. Thats a great help. Thank you for your help.
Page Template Dropdown Does not exist??
I did re-activate the theme as the FAQs suggested, but it still does not apprear.
My newly create template appears in the list when I select
Appearance >> Editor
HOWEVER, it just has the filename, page_no_sidebar.php and doe snot have the title of “Template” not sure if this makes a difference.
Any help?
Thanks!
The topic ‘hide sidebar on pages?’ is closed to new replies.