How to delete the side bar in one page in my template?
-
Hi i have the Fancy template , i want to have a main web that doesnt have the sidebar that my template has, how can i delete them ?
Thanx !
This is my web : http://www.tweakingknobs.com
-
Replace ‘<?php get_sidebar():?>
with
<?php if(!is_page(‘Page Name’)) get_sidebar();?>` in the relevant template file.Thanx esmi ,
I have searcheed it in my admin page, themes , edit themes and then in side bar option.
but there is nothing like that.
i have used the search function and is not there.
Maybe i am looking in the wrong place.
.any ideas?
thanx !
this is the code in my sidebar option ,
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : ?> <!--sidebox start --> <div class="widget_archive"> <h3 class="block title-1"><?php _e('Archives'); ?></h3> <div class="paddings"> <ul class="list-2 block"> <?php wp_get_archives('type=monthly'); ?> </ul> </div> </div> <!--sidebox end --> <!--sidebox start --> <div class="widget_links"> <h3 class="block title-1"><?php _e('Links'); ?></h3> <div class="paddings"> <ul> <?php get_links('-1', '<li>', '</li>', '<br />', FALSE, 'id', FALSE, FALSE, -1, FALSE); ?> </ul> </div> </div> <!--sidebox end --> <!--sidebox start --> <div class="widget_categories"> <h3 class="block title-1"><?php _e('Categories'); ?></h3> <div class="paddings"> <ul> <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?> </ul> </div> </div> <!--sidebox end --> <?php endif; ?> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(2) ) : ?> <!--sidebox start --> <!-- <div class="widget_meta green"> <h3 class="block title-1">Meta</h3> <div class="paddings"> <ul> <li class="rss"><a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a></li> <li class="rss"><a href="<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a></li> <li class="wordpress"><a href="http://www.wordpress.org" title="Powered by WordPress">WordPress</a></li> <li class="login"><?php wp_loginout(); ?></li> </ul> </div> </div> --> <!--sidebox end --> <!--sidebox start --> <!-- <div class="widget_calendar green"> <h3 class="block title-1">Calendar</h3> <div class="paddings"> <div id="calendar_wrap"><?php get_calendar(); ?></div> </div> </div> --> <!--sidebox end --> <?php endif; ?> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?> <!--sidebox start --> <!-- <div class="widget_recent_entries pink"> <h3 class="block title-1"><?php _e('Recent Articles'); ?></h3> <div class="paddings"> <ul> <?php $side_posts = get_posts('numberposts=10'); foreach($side_posts as $post) : ?> <li><a href= "<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> </div> </div> --> <!--sidebox end --> <?php endif; ?>
The code is in the index.php, single.php and page.php
In your case I would say do what esmi suggested in the page.php
Thanx Zgani,
I replaced it like esmi told me , i did it in the page.php option , updated the code , but the side bar is still there ,in all the pages.
this is the new code:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”EN” lang=”EN”>
<head>
<?php get_header(); ?>
</head>
<body>
<div class=”main”>
<div class=”container”>
<div class=”span-24 header”>
<div class=”name”>“><?php bloginfo(‘name’); ?></div>
<span class=”slogan”><?php bloginfo(‘description’); ?></span>
</div><?php include (TEMPLATEPATH . “/navigation.php”); ?>
<?php include (TEMPLATEPATH . “/banner.php”); ?>
<div class=”span-24 content”>
<div class=”span-16 post-wrapper”>-
<?php if (have_posts()) : ?>
-
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that isn’t here.</p>
<?php while (have_posts()) : the_post(); ?>
<li class=”post”>
<div class=”text-header”>
<h2 class=”title”><?php the_title(); ?></h2>
<div class=”clear”></div>
</div><div class=”hr”><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/img/<?php echo $scissors; ?>” alt=”scissors” /></div>
<?php the_content(‘Read the rest of this entry »’); ?>
<?php the_tags(‘<span class=”tag”> Tags: ‘, ‘, ‘, ‘</span>’); ?>
<?php edit_post_link(‘Edit’, ‘<p class=”edit”>’, ‘</p>’); ?><?php endwhile; ?>
<?php else : ?><?php endif; ?>
</div>
<div class=”span-8 last sidebar”>
<?php if(!is_page(‘Page Name’)) get_sidebar();?>
</div>
</div><?php get_footer(); ?>
</div>
</div>
</body>
</html>please help.
I think you will be better off creating a new template and omit the sidebar alltogether. You can then use that template for pages where you dont want the sidebar to appear.
Here’s how to: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates
Thanx ,
are you saying that i should use a new template that doesnt have a sidebar ? If so , i actually like this one very much.
And if i use one template for one page and this one , both pages will be different and there will be no consistensy in aesthethics. one will look different than the other right ?
Is this so difficult to change with code ?
Try like this:
<?php if(!is_page(‘Page Name’)) {
<div class=”span-8 last sidebar”>
<?php get_sidebar();?>
</div>
<?php } ?>And maybe, modify your style.css file.
Thanx, but where exactly should i paste that , for example in the Index.php page ?
Thanx. This is how my code looks in my index.php page :
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”EN” lang=”EN”><?php get_header(); ?>
<body>
<div class=”main”>
<div class=”container”>
<div class=”span-24 header”>
<h1 class=”name”>“><?php bloginfo(‘name’); ?><!–<span class=”bubble”><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/img/<?php echo $bubbles; ?>” alt=”bubbles” /></span>–></h1>
<span class=”slogan”><?php bloginfo(‘description’); ?></span>
</div><?php include (TEMPLATEPATH . “/navigation.php”); ?>
<?php include (TEMPLATEPATH . “/banner.php”); ?>
<div class=”span-24 content”>
<div class=”span-16 post-wrapper”>-
<?php if (have_posts()) : ?>
-
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that isn’t here.</p>
<?php while (have_posts()) : the_post(); ?>
<li class=”post”>
<div class=”text-header”>
<h2 class=”title”>” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
<span class=”no”><?php comments_number(‘0’, ‘1’, ‘%’, ‘comments’); ?></span>
<div class=”clear”></div>
</div><div class=”hr”><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/img/<?php echo $scissors; ?>” alt=”scissors” /></div>
<div class=”info-small”>
<span class=”date”><?php the_time(‘F jS, Y’) ?></span><span class=”author”><?php the_author() ?></span><span class=”cat”><?php the_category(‘, ‘) ?></span>
</div><?php the_content(‘Read the rest of this entry »’); ?>
<div class=”clear”></div>
<?php the_tags(‘<span class=”tag small”> Tags: ‘, ‘, ‘, ‘</span>’); ?>
<?php edit_post_link(‘Edit’, ‘<p class=”edit”>’, ‘</p>’); ?><?php endwhile; ?>
<?php else : ?><?php endif; ?>
<li class=”post”>
<p class=”alignleft”><?php next_posts_link(‘« Older Entries’) ?></p>
<p class=”alignright”><?php previous_posts_link(‘Newer Entries »’) ?></p></div>
<div class=”span-8 last sidebar”>
<?php if(!is_page(‘index.php’)) get_sidebar();?>
</div>
</div><?php get_footer(); ?>
</div>
</div>
</body>
</html> -
<h2>Not Found</h2>
- The topic ‘How to delete the side bar in one page in my template?’ is closed to new replies.