Remove Sidebar from Single PHP.

Discussion in 'HTML & Website Design' started by whiteshadow18, Jan 4, 2011.

  1. #1
    I have the site imediazone.net and i want to remove the middle sidebar, not the right one: The code for the single.php is
    
    <?php get_header(); ?>
    
    <div id="contentwrap">
    
    	<?php  if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    				<h2 class="titles"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    				<div class="entry">
    					<?php the_content(''); ?>
    				</div>
    
                	<p class="postmetadata"><?php the_tags(); ?></p>
    			</div>
    
                <?php comments_template(true, ''); ?>
    
    		<?php endwhile; ?>
    
    	<?php endif; ?>
    </div>
    <?php get_sidebar(); ?>
    
    
    <div id="footer">
    <div class="alignleft">Copyright &copy; <?php the_time('Y'); ?> Imediazone Blog. All Rights Reserved.</div> 
    <div class="alignright"><a href="http://www.imediazone.net/tos">Terms of Use</a> | 
    <a href="http://www.imediazone.net/link-exchange/">Link Exchange</a> | 
    <a href="http://www.imediazone.net/contact/">Contact</a>
    </div>
    </div>
    
    <?php
     $code = get_option('swt_custom_analytics_code'); echo stripslashes($code);
    ?>
    <?php wp_footer();?>
    </body>
    </html>
    
    Code (markup):
    and the code for sidebar.php is
    
    <div id="right-column">
    
    
    
    <?php if ((get_option('swt_gallery2') == 'Display') && (is_home() || is_search() || is_category() || is_archive()) ){ ?>
    
    <?php { include(TEMPLATEPATH . '/includes/gallery2.php'); } ?>
    
    <?php } else { echo ''; } ?>
    
    
    
    <div class="sidebar">
    
    
    
    <?php if (get_option('swt_fcats') == 'Hide') { ?>
    
    <?php { echo ''; } ?>
    
    <?php } else { include(TEMPLATEPATH . '/includes/featured-cats.php'); } ?>
    
    
    
    <?php if (get_option('swt_popular') == 'Hide') { ?>
    
    <?php { echo ''; } ?>
    
    <?php } else { include(TEMPLATEPATH . '/includes/mostpopular.php'); } ?>
    
    
    
    
    
        <?php if (!function_exists('dynamic_sidebar')
    
    	|| !dynamic_sidebar()) : ?>
    
    
    
        <div class="side-widget">
    
        <h3>Pages</h3>
    
        <ul><?php wp_list_pages('title_li=' ); ?></ul>
    
        </div>
    
    
    
        <div class="side-widget">
    
        <h3>Categories</h3>
    
        <ul>
    
        <?php wp_list_categories('title_li=' ); ?>
    
        </ul>
    
        </div>
    
    
    
         <?php endif; ?>
    
    </div>
    
    <div class="sidebar border">
    
    
    
    <?php if (get_option('swt_aboutcheck') == 'Hide') { ?>
    
    <?php { echo ''; } ?>
    
    <?php } else { include(TEMPLATEPATH . '/includes/aboutus.php'); } ?>
    
    
    
    
    
    <?php if (get_option('swt_social') == 'Hide') { ?>
    
    <?php { echo ''; } ?>
    
    <?php } else { include(TEMPLATEPATH . '/includes/social.php'); } ?>
    
    
    
    
    
    <?php if (get_option('swt_banners') == 'Hide') { ?>
    
    <?php { echo ''; } ?>
    
    <?php } else { include(TEMPLATEPATH . '/includes/banners.php'); } ?>
    
    
    
        <?php if (!function_exists('dynamic_sidebar')
    
    	|| !dynamic_sidebar(2)) : ?>
    
    
    
        <div class="side-widget">
    
        <h3>Pages</h3>
    
        <ul><?php wp_list_pages('title_li=' ); ?></ul>
    
        </div>
    
    
    
        <div class="side-widget">
    
        <h3>Categories</h3>
    
        <ul>
    
        <?php wp_list_categories('title_li=' ); ?>
        </ul>
        </div>
    
        <?php endif; ?>
    
    </div>
    </div>
    </div>
    
    Code (markup):
    My style CSS you can find it here

    Also after removing the middle sidebar i belive it would live a space, also that problem if it can be fixed, giving reputation point and itrader for service, Thank you for the help.
     
    whiteshadow18, Jan 4, 2011 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Remove the left sidebar from the template (sidebar.php):

    
    <div id="right-column">
    
    <?php if ((get_option('swt_gallery2') == 'Display') && (is_home() || is_search() || is_category() || is_archive()) ){ ?>
    <?php { include(TEMPLATEPATH . '/includes/gallery2.php'); } ?>
    <?php } else { echo ''; } ?>
    
    <div class="sidebar border">
    
    <?php if (get_option('swt_aboutcheck') == 'Hide') { ?>
    <?php { echo ''; } ?>
    <?php } else { include(TEMPLATEPATH . '/includes/aboutus.php'); } ?>
    
    <?php if (get_option('swt_social') == 'Hide') { ?>
    <?php { echo ''; } ?>
    <?php } else { include(TEMPLATEPATH . '/includes/social.php'); } ?>
    
    <?php if (get_option('swt_banners') == 'Hide') { ?>
    <?php { echo ''; } ?>
    <?php } else { include(TEMPLATEPATH . '/includes/banners.php'); } ?>
    
        <?php if (!function_exists('dynamic_sidebar')	|| !dynamic_sidebar(2)) : ?>
    
        <div class="side-widget">
        <h3>Pages</h3>
        <ul><?php wp_list_pages('title_li=' ); ?></ul>
        </div>
    
        <div class="side-widget">
        <h3>Categories</h3>
        <ul>
        <?php wp_list_categories('title_li=' ); ?>
        </ul>
        </div>
    
        <?php endif; ?>
    
    </div>
    </div>
    </div>
    
    Code (markup):
    In the main stylesheet (style.css), change the properties of #contentwrap and #right-column to these:
    
    #contentwrap {
      float: left;
      [COLOR="red"]width: 640px;[/COLOR]
      margin-right: 20px;
    }
    #right-column {
      [COLOR="red"]width: 300px;
      float: right;[/COLOR]
    }
    
    Code (markup):
    Finally, change the width of the mygallery plugin to 300px. I'm not sure if there is an option for that or if you need to edit the stylesheet (gallery2.css) :
    
    #mygallery3 {
      [COLOR="red"]width: 300px;[/COLOR]
      height:296px;
      background: url(../images/gallery.png) repeat-x;
      margin-bottom: 20px;
    }
    
    Code (markup):
    Hope that works :). BTW, I believe you can only give iTrader for paid jobs in the BST forums.
     
    Last edited: Jan 5, 2011
    Cash Nebula, Jan 5, 2011 IP
  3. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    One Question, if i remove the left sidebar from the template (sidebar.php), wont it dissapear from the index.php, categories php, because i want this ONLY on the single post view (single.php) to be removed.
     
    whiteshadow18, Jan 5, 2011 IP
  4. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Done, i have created a new sitebar, called sidebar-single.php besides the other one, created new selectors, #sidebarsingle and #right-columnsingle, and in single php instead of adding get_sidebar(), i have added the single-sidebar.php with include, anway thank you for your efforts, problem fixed, request a moderator to close the thread
     
    whiteshadow18, Jan 5, 2011 IP
  5. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You got it :) That method works fine, but you can also use the sidebar function to load another template.
    <?php get_sidebar('single'); ?> loads sidebar-single.php
     
    Cash Nebula, Jan 5, 2011 IP
  6. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Indeed, Thanks man
     
    whiteshadow18, Jan 6, 2011 IP