- This topic has 9 replies, 3 voices, and was last updated 3 years, 3 months ago by
David.
-
AuthorPosts
-
December 27, 2022 at 7:03 am #2474679
Lutz
Hi,
I want to configure GeneratePress in the way that:
– on desktops my homepage has only a left sidebar
– on mobiles the page has both sidebars (one above and one below the main content)
How can I get this?
I found no way with the Customizer.
Best regards, LutzDecember 27, 2022 at 1:30 pm #2475075Ying
StaffCustomer SupportHi Lutz,
1. Go to customizer > layout > sidebars, and set the sidebar layout you want on the desktop for the homepage.
2. Go to appearance > elements, create a new layout element, set the sidebar layout you want for mobile, and add
Front pageto the location, write down the element’s ID, which can be found in the URL of the element editor.3. Add this PHP code, and replace
100with your element’s ID.add_filter( 'generate_element_display', function( $display, $element_id ) { if ( 100 === $element_id && !(wp_is_mobile()) ) { $display = false; } return $display ; }, 10, 2 );Adding PHP: https://docs.generatepress.com/article/adding-php/
4. Add this CSS if you want the left sidebar appear first:
@media (max-width: 768px) { #left-sidebar { order: -1; } }Adding CSS: https://docs.generatepress.com/article/adding-css/
December 29, 2022 at 4:54 am #2476738Lutz
Hi Ying.
Tip 1. to 3. works fine – thanks!
But re-ordering the sidebars with the CSS causes a new problem. The sidebars are re-ordered correctly (fine), but: the separators between sidebar/primary/sidebar are not correctly re-placed. There is no space between the primary content and the lower sidebar – but double-sized space between upper sidebar and primary content.
-LutzDecember 29, 2022 at 5:45 am #2476787David
StaffCustomer SupportHi there,
to share a screenshot you need to provide the URL that links to the image, you can save the image in cloud drive, your WP media library or use one of the many image sharing services.
December 29, 2022 at 5:50 am #2476790Lutz
Thanks.
See the screenshots (link in private information area) …
-LutzDecember 29, 2022 at 5:55 am #2476793David
StaffCustomer SupportCan i see the actual website too ?
December 29, 2022 at 6:02 am #2476797Lutz
Hi.
The site is currently in work – but I leave the parts which causes the problem with the sidebar separators unchanged.
So you can check it.
URL and login in the private informations.
-LutzDecember 29, 2022 at 6:08 am #2476802David
StaffCustomer SupportTry changing #4 css to:
@media (max-width: 768px) { #left-sidebar { order: -1; } #main, .entry-content { margin-top: 0 !important; margin-bottom: 1.2em !important; } }December 29, 2022 at 6:10 am #2476803Lutz
Perfect – that’s it!
Many thanks.
-LutzDecember 29, 2022 at 6:16 am #2476807David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.