I found a code for removing the sidebar from one specific page, but what is the code for removing the sidebar from multiple pages, for the page template? I'd rather do that than find a plug in.
I found a code for removing the sidebar from one specific page, but what is the code for removing the sidebar from multiple pages, for the page template? I'd rather do that than find a plug in.
You found a code for removing a sidebar from one page? Would you share the code? I ve been looking for help with that.
Thanks in advance.
It had me edit the page template and find:
<?php get_sidebar(); ?>
and adjust it to look like this ...
<?php if (is_page('x')) : ?>
<?php else : ?>
<?php get_sidebar(); ?>
<?php endif; ?>
where it says x you need to put in the page number of the page you want it removed from...you can find that by going to your list of pages and mousing over the pages, then look at the base of your screen to see the url - the page number is at the end of that url
Thank you so very much.
Thanks again, that work- the sidebar is gone. But I still have the grey area showing. Would you know how to stretch the content of the page? I'm using the page for a forum.
androidnews
I love the code for removing the sidebar on a page, but what if I want to remove it from more that one page. I tried
<?php if (is_page('x', 'y')) : ?>
But it only worked on the x page.
Any word on this, I really need per page ability to remove side bar.
I ended up making custom page templates with variations on what sidebars I wanted showing. Worked great.
got a tutorial on that? I wish this code worked ;)
I tried the fix above and it did not work for me to remove the sidebar from the one page. I also would like any tutorial on custom page templates. All I really want, though is to remove the sidebar from that one page.
It works for sure.
Here is tutorial.
Modify your page.php file
In your WordPress Editor, go to Appearance / Editor and click on page.php. Scroll down to the bottom of the file where you will see the line of code that displays your sidebar:
<?php get_sidebar(); ?>
Replace that one line with this:
<?php if ( !( is_page(‘696‘) ) ) { ?>
<?php get_sidebar(); ?>
<?php } ?>
Note that you will need to replace the red 696 post ID number above with your Post ID number.
Save the file. You’re done.
[Please post code snippets between backticks or use the code button.]
Got to be a way to use PHP in the page.php to define what pages you want to exlude the side bar from?
<?php if( !is_page( array( 42, 54, 6 ) ) ) get_sidebar());?>
Do I add this code to the above or delete the above and replace with this?
It's meant as a replacement but you must add in your own page ids.
Ok thanks, and I just add that to the page.php in place of what I had correct?
Yes
It worked this time. I was using the wrong number to identify the page number.
THANK YOU!!
Put his code:
<?php if( !is_page( array( 124, 379, 6 ) ) ) get_sidebar()){?>
<?php get_sidebar(); ?>
<?php } ?>
Didnt work, it 500'd all my pages
I also added JUST this:
<?php if( !is_page( array( 124, 379, 111 ) ) ) get_sidebar());?>
Same result, 500 all ages.
Ok, so I created a custom page template named nosidebar.php.
I can choose it from the drop down when I add a page and it does not have a side bar.
BUT, as I have read I still have the space bloacked out for the side bar. I copied the page.php code removed the sidebar code.
Now, the page.php script is :
<?php
/*
Template Name: nosidebar
*/
?>
<?php get_header(); ?>
<div class="span-16">
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2 class="title"><?php the_title(); ?></h2>
<div class="entry">
<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(300,225), array("class" => "alignleft post_thumbnail")); } ?>
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php wp_link_pages(array('before' => '<p>Pages: ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
</div>
<?php endwhile; endif; ?>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</div>
</div>
</div>
<?php get_footer(); ?>
What do I do to call a css style that will give me control over this page container? It doesnt call container, even if I add a different content value it doesnt seem to work.
I got it, it was a template that called a span style, once I found the source css i could determine the proper width.
Solved, learned a few things along the way also.
;)~
Ok... I've been trying this code but the area that is the sidebar still is blocked out and the image in the main posting area is cut off. I want the sidebar completely removed and the posting area to take up that space so my image will show properly.
Here is a link to the page where I am having issues.
http://www.golivetoday.com/wp/?page_id=126
Is there somewhere to designate how large the posting area is on one page? Or am I looking in the wrong direction?
You must log in to post.