Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to remove a widget area (lateral), and extend the page width getting this area. What is the better way to do it?

share|improve this question

2 Answers 2

Hook into register_sidebar and remove the sidebar from the global array $wp_registered_sidebars:

add_action( 'register_sidebar', function( $sidebar )
{
    if ( 'lateral' === $sidebar[ 'name' ] )
        unset( $GLOBALS['wp_registered_sidebars'][ $sidebar[ 'id' ] ] );
});

Then adjust the stylesheet or add extra CSS to wp_head to let the page content take the full width.

See also: Change a sidebar name?

share|improve this answer
    
What do you mean with register_sidebar? The sidebar.php file? I have not any register_sidebar file. And wp_head? I have a header.php file that includes the <head> tags. –  Manolo Aug 31 '13 at 10:38
    
register_sidebar is the action fired after after a sidebar has been registered by a theme or plugin. wp_head is the main action in a theme’s header; you can add new content here with add_action(). –  toscho Aug 31 '13 at 11:23
    
And where are the files which contain these actions? –  Manolo Aug 31 '13 at 13:03
    
These are core files, you should not add your code there, use a plugin or the theme’s functions.php instead. –  toscho Aug 31 '13 at 13:06
    
I've tried to add the snippet code at the end of my theme's functions.php file, but nothing changes. Whether I add an aside zone widget, or whether not, the result is the same. –  Manolo Sep 1 '13 at 23:13
up vote 0 down vote accepted

I've found an easy way:
Simply change your stile.css file.

Replace this code snippet:

 /**
* 5.0 Content
*    ----------------------------------------------------------------------------
*/

.hentry {
padding: 40px 0;
}

.entry-header,
.entry-content,
.entry-summary,
.entry-meta {
margin: 0 auto;
max-width: 604px;
width: 100%;
}

.sidebar .entry-header,
.sidebar .entry-content,
.sidebar .entry-summary,
.sidebar .entry-meta {
max-width: 1040px;
padding: 0 376px 0 60px; 
} 

With this:

 /**
* 5.0 Content
*    ----------------------------------------------------------------------------
*/

.hentry {
padding: 40px 0;
}

.entry-header,
.entry-content,
.entry-summary,
.entry-meta {
margin: 0 auto;
max-width: 1280px;  /* or the maximum resolution that you want*/
width: 100%;
}

.sidebar .entry-header,
.sidebar .entry-content,
.sidebar .entry-summary,
.sidebar .entry-meta {
max-width: 1040px;
padding: 0 20px 0 20px;  /* or the right/left padding that you want */
}

and disable all the aside zone widgets.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.