Site logo

Archived topic

how to have a different width for post and archives?

5 replies · Started by Silvio on November 22, 2018

Viewing posts 1–6 of 6

hi, I want to have different width for post, pages and archives.

I set container to 600px and then:

- single post: no sidebar (set in layout)
- pages: no sidebar (set in layout)
- archives: right sidebar (set in layout)

I want the archives to be width container + sidebar (600px + sidebar, not inlcuded).

I created an element, but with regard to container I have 3 option: default (not good), full (not good), contained (isn't it the same of default?) How can I set the width of the container with element?

Hi there,

We are working to add the container width option into Layout Elements :)

For now, I believe the best way to handle your case would be to let the customizer option to handle the widths of the layout with sidebars.

Then we can use this CSS to set the content container width when there isn't a sidebar:

body.no-sidebar .site.grid-container {
    max-width: 600px;
}

Adding CSS: https://docs.generatepress.com/article/adding-css/

Let me know if this helps :)

while it works, this creates problem with the header, that is no more aligned with the content

You can add another rule to give the header some padding:

body.no-sidebar .inside-header {
    padding-left: 47px;
    box-sizing: border-box;
}

this a bit too much code.

could I instead add an element with content/sidebar and width contained that displays to archives or specific pages and add a css rule like

.body-sidebar-content .site-grid-container {
width:900px

}

I tried but it didn't work

Not quite sure what you mean but what about changing the width of the entire container including the header on pages no sidebar pages?

body.no-sidebar .grid-container {
    max-width: 600px;
}
This archived topic is closed to new replies.