Remove sidebar column in some pages? Please Help

by KubiK
10 replies
  • WEB DESIGN
  • |
Hey Warriors, I tried everything available on the net with no avail. I want to remove the sidebar from certain pages, so that the remaining body content of the page will occupy the full width.

What I managed to do is to remove the sidebar, but the remaining content won't span the entire width, the used-to-be sidebar area simply becomes blank.

The steps I took:
* Duplicate the content of the page.php with the following modifications:

1) add

<?php
/*
Template Name: Custom Page
*/
?> before all pre-existing codes.

2) Remove <?php get_sidebar(); ?>

3) Change the div id from "pagecontent" to "custom-page-content-wrapper"

4) Save it as another .php file and upload to WP via Filezilla

5) Then I opened the style.css and at the bottom, I add

#custom-page-content-wrapper
{
width: 100%;
float: left;
margin: 0;
}

6) I was able to go to the designated page and switch the template to the new one. And it does remove all content from the sidebar except the remaining content doesn't expand over the full width. Please help. Thanks.
#column #pages #remove #sidebar
  • Profile picture of the author DreamTex
    since this is a WP setup you should find on the wyiswyg editor section for your page a section to choose full page or with sidebar
    {{ DiscussionBoard.errors[8278322].message }}
    • Profile picture of the author Istvan Horvath
      Originally Posted by DreamTex View Post

      since this is a WP setup you should find on the wyiswyg editor section for your page a section to choose full page or with sidebar
      Total crap... you have no idea what you are talking about!

      Theme/layout setting are NOT part of WP setup. Period.
      Don't comment if you lack the knowledge.

      To the OP: you are on the right way... probably, you've missed one little code somewhere, that's why the empty space of the sidebar didn't disappear.

      Nobody will ever be able to tell you without knowing/seeing the theme files; i.e. which theme is in use that you are trying to modify.
      Signature

      {{ DiscussionBoard.errors[8280251].message }}
      • Profile picture of the author KubiK
        I am using the Exact Theme (the name is called "Exact"). I modified the original page.php and created this page_no_sidebar.php by giving it a new name and remove the code calling for side bar.

        <?php
        /**
        Template Name: No Sidebar
        */

        get_header(); ?>
        <div id="pagecontent">

        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); //The Loop?>

        <div <?php post_class(); ?>>

        <h1><?php the_title(); ?></h1>


        <?php the_content(); ?>

        <div class="postfooter">
        <?php wp_link_pages() //Page buttons for multi-page posts?>
        </div>


        </div>


        <?php comments_template(); ?>
        <?php endwhile;endif;?>

        </div>
        </div>
        <?php get_footer(); ?>

        This is, , the youtube *closest* to give out the solution. However, in the video at 0.33s, he created another class and modify it in the css file. I don't see anything like that in the page.php from the Exact theme. So I am not sure what to do. Do I need to identify the corresponding class? If so, any suggestion of how?
        {{ DiscussionBoard.errors[8280357].message }}
  • Profile picture of the author KubiK
    Under Page Attribute, there is used to have No Option of template. I am using the free wordpress theme called Exact. And I don't think there is Page layout options. And that's why I am trying to create a page template of my own without the sidebar portion, I have successfully uploaded it and now I have two options under "Template" under "Page Attribute", one is default and the other is my added template. Both of which still have the sidebar area being occupied.
    {{ DiscussionBoard.errors[8279445].message }}
  • Profile picture of the author KubiK
    I am still trying, but making some progress. I am using the process of elimination to see which .php file is related to what I am talking about and locate the header.php file. Its code is as follows:

    ==================================
    <?php
    /**
    * The Header for the Exact theme.
    *
    * It displays all of the <head> section and everything up until <div id="maincol">
    *
    * @package WordPress
    * @subpackage Exact
    * @since Exact 1.0
    */
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html <?php language_attributes('xhtml'); ?> xmlns="http://www.w3.org/1999/xhtml">
    <head>


    <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>;charset=<?php bloginfo('charset'); ?>"/>

    <title><?php wp_title( '|', true, 'left' ); ?></title>

    <link rel="profile" href=" http://gmpg.org/xfn/11" />

    <?php wp_head(); ?>
    </head>
    <body <?php body_class(); ?>>
    <div id="header">
    <div id="headertitle"><h1><a href="<?php echo site_url(); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1></div>
    <div id="headerimage" style="width:<?php echo HEADER_IMAGE_WIDTH; ?>px; height:<?php echo HEADER_IMAGE_HEIGHT; ?>px;"><a href="<?php echo site_url(); ?>" title="<?php bloginfo('name'); ?>"><img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="<?php bloginfo('name'); ?>"/></a></div>
    </div>
    <div id="page">

    <div id="headermenu">
    <?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'depth' => '1','items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>') ); ?>
    </div>

    <div id="wrapper" class="clearfix" >

    <div id="maincol" >
    ==================================

    Currently it looks like attachment 1
    When I remove "<div id="maincol" >", it looks like attachment 2;
    When I remove "<?php wp_head(); ?> ", it looks like attachment 3.

    I am still not sure what can be done next, and also these effects apply to all pages since it's under the head.php.
    {{ DiscussionBoard.errors[8280748].message }}
  • Profile picture of the author Istvan Horvath
    OK, I couldn't find that theme doing a quick search.

    1. If it is a "premium" theme, i.e. you pad for it - go to their support site: nobody will be able to help you unless they have the same theme.
    2. If it is a free theme - any helper will need the download URL to be able to look into all the files.
    3. The fix should be found by carefully looking at the CSS statement referring to any (or all) of these:
    Code:
    <body <?php body_class(); ?>> 
    [...]
    <div id="page">
    [...]
    <div id="wrapper" class="clearfix" > 
    <div id="maincol" >
    Obviously, there must be somewhere a theme setting/option feature to set the BODY class - because the code expects a variable.

    Just removing a div will kill your page

    (and never touch that wp_head thingy... lots of themes and plugins rely on it!)
    Signature

    {{ DiscussionBoard.errors[8281816].message }}
    • Profile picture of the author rhinocl
      If you put this up live, you stand a better chance of some one finding a solution for you.
      In the mean time look at the div right under the wrapper in the hierarchy-maybe something like main-column You may have to increase the width of it like you did for the wrapper:
      #custom-page-content-wrapper
      {
      width: 100%;
      float: left;
      margin: 0;
      }
      {{ DiscussionBoard.errors[8281892].message }}
      • Profile picture of the author KubiK
        It is a theme by Hannah Owen. Exact WordPress Theme | Electric Themes In wordpress, type "exact" in the search bar, and it should pop up. I have tried both of your suggestions without effect, not sure if I am doing it right.
        {{ DiscussionBoard.errors[8284326].message }}
  • Profile picture of the author Ron Killian
    Creating a template is the way to go, so you do it once and can use it over and over, without messing with code. I use a salespage template myself and it's so much better than editing php files.

    Unless I missed it, you just need to create new css, just for the template, to get the full width, for example, and add it to your theme's style.css file.

    Or am I not getting what your looking to do?
    Signature
    PLR Affiliate Program Has Launched! Easily Promote Over 5,000 PLR and MRR Products.

    Largest Selection of PLR Articles on the Planet! PLR Ebooks, PLR Video, PLR Websites and more with Private Label Rights
    {{ DiscussionBoard.errors[8284918].message }}
  • Profile picture of the author Istvan Horvath
    Reminder: in most WP themes the "beginning" of the <body> and some following elements that repeat in most of the files are included in the header.php.

    Which means if the body class and after that several big container divs are defined in the header.php and you call the same header (get_header = default) in each template... then you will face difficulties customzing the basic width, number of columns etc.
    Signature

    {{ DiscussionBoard.errors[8285344].message }}
  • Profile picture of the author carleywatson
    [DELETED]
    {{ DiscussionBoard.errors[8289858].message }}

Trending Topics