Archived topic
Always centered, and same text-content width, independent of sidebar(s)
1 reply · Started by blackbird on June 11, 2021
Hi.
If i set an Elements layout for my About pages and state ”these pages should NOT have a sidebar and they should be max 900 px wide”. The text and images on these pages will be nicely centered in the middle of the pages, and not being too wide. I can still have the container default width 1200 for other pages. Good.
But what if I also want a lot of other static pages, that DO include one sidebar, to ALSO always have the content text and images CENTERED in the middle and also THE SAME WIDTH of 900 px wide. So they look exactly the same, except these pages DO have a sidebar (or some kind of extra content) added off to the side off them. And some other pages may have sidebars on both sides, but I still want to keep the main content always 900 px wide for a consistent look! (Not make it more narrow or moved to left or right side, because there is a sidebar added, or not...)
But to mix it up there may also be a lot of plugin-generated pages (like download or shop) that still need the default container width, so the whole site is a mix!!
How to work "future-proof", without adding to much code, or make the pages to block-complicated for people who needs to re-work text content later?
Maybe I need to work with page templates (?), but I haven´t got the basics of that yet, especially when mixing static pages and plugin-generated pages. Guess I need more knowledge in this area..?
2.
When I add "locations" to an Element, how many pages can I add before it will be too "much/heavy". It seems like it is meant for 1-5 pages. Or can I add 50 pages to the location for an Element layout?! A long list...
3.
And also: Is the "classic wp-sidebars" still the best future-proof way to work? Or should/could we build different page layouts with "elements/blocks" off to the side of the main content instead of sidebars, without problems or code bloat?!
With all new exciting Elements layout and GP Blocks possibilities (and templates) there seem to be almost too many ways to handle the width of the site, of pages, of elements, of containers, of blocks and so on... But I love the freedom it opens!
(I do not use Elementor or any other Page builder.)
Hi there,
best thing to do is to decide upon the exact layouts you require.
And generate the various Layout Elements you need.
And then check this topic which will make it so you can select an Element display from within the post editor:
https://generatepress.com/forums/topic/header-layout-control-for-client/#post-1421567
Sidebars - if you're still intending to use Widgets then best left to default theme sidebars. This will change with WP 5.8 when they should have Blockified those core widgets....
Regarding centring content when a single sidebar is present then that would require some CSS ( or by adding an empty sidebar to the other side ). But you will need to consider overall screen space - for example:
350px left sidebar (or empty space of same width) + 900px content + 350px right sidebar only works on screens with a min width of 1600px ... Anything below that - unless those element widths reduce the content will be off center....