- This topic has 10 replies, 4 voices, and was last updated 8 years, 8 months ago by
Tom.
-
AuthorPosts
-
June 29, 2017 at 1:11 pm #341597
Suzanne
Hi,
I have 3 widgets currently setup as left sidebar widgets in both desktop and mobile views. This is the format I’d like to keep for the desktop view.I would like to change the mobile(phone) view to display them in this stacking order:
Logo
Menu
Widget 1
Widget 2
Widget 3
Body contentHere is the link to my existing site: https://tinyurl.com/h94tt6d
Here is a link to a mockup of what I’m trying to achieve: https://tinyurl.com/y9z2hhn9What do I need to modify? Thanks in advance.
June 29, 2017 at 1:22 pm #341602Leo
StaffCustomer SupportHi there,
Can you give this CSS a shot?
@media (max-width: 768px) { .site-content { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-flow: row wrap; flex-flow: row wrap; } #left-sidebar { -webkit-box-ordinal-group: 1; -moz-box-ordinal-group: 1; -ms-flex-order: 1; -webkit-order: 1; order: 1; } .content-area { -webkit-box-ordinal-group: 2; -moz-box-ordinal-group: 2; -ms-flex-order: 2; -webkit-order: 2; order: 2; } }Adding CSS: https://docs.generatepress.com/article/adding-css/
June 29, 2017 at 1:27 pm #341605Suzanne
Hi, I don’t want the entire left sidebar to be in the new location for mobile, only the first three widgets. The first three widgets have the green arrows and text. The remaining left sidebar widgets can stack at the bottom as usual.
June 29, 2017 at 5:05 pm #341718Suzanne
Hi,
So I put the code into my CSS and all the sidebar widgets are now in my mobile display. Any ideas how to only place the first three widgets at the top? The first three widgets have the green arrows and text. The remaining left sidebar widgets can stack at the bottom as usual.Thanks for your help,
SuzanneJune 29, 2017 at 7:50 pm #341763Tom
Lead DeveloperLead DeveloperHi Suzanne,
I’m afraid there’s no simple way to do that.
You would need to add the widget content into a hidden div using GP Hooks, and show that div on mobile only:
<div class="hide-on-desktop hide-on-tablet"> Mobile content in here </div>June 30, 2017 at 5:27 am #341950Suzanne
Fantastic, thank you! That worked to display the widgets in the location I need.
The sidebar widgets are still appearing in mobile stacked below the content and I don’t want them to show there in the mobile version. How do I hide?
June 30, 2017 at 8:21 am #342027Tom
Lead DeveloperLead DeveloperYou can use a plugin like this: https://wordpress.org/plugins/widget-css-classes/
Then give the widgets you want to hide on mobile this class:
hide-on-mobileJuly 24, 2017 at 11:19 am #354176Suzanne
Hi, I finally had time to circle back and work on this. IT WORKED! Thank you so much for your support!
July 24, 2017 at 8:00 pm #354372Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
July 25, 2017 at 12:18 am #354417Roman
Hi Tom, as you know I use media queries for hiding sidebars at certain breakpoints while maintaining average line length (see CSS below). I wonder how to move (display) sidebars to (in) footer widgets using GP hooks at points where I hide them. I use Content Aware Sidebars plugin but it doesn’t allow media queries and I don’t want to use other plugin. Also I don’t want to use flexbox.
@media screen and (max-width: 1395px) {
.widget-area.grid-20 {
width: 21%;
}
.widget-area.grid-25 {
width: 25%;
}
.content-area.grid-55 {
width: 54%;
}
}
@media screen and (max-width: 1335px) {
.widget-area.grid-20 {
width: 20%;
}
.widget-area.grid-25 {
width: 26%;
}
.content-area.grid-55 {
width: 54%;
}
}
@media screen and (max-width: 1200px) {
.widget-area.grid-20 {
display: none;
}
.widget-area.grid-25 {
width: 30%;
}
.content-area.grid-55 {
width: 70%;
}
.tablet-push-20 {
left: initial;
}
}
@media screen and (max-width: 1000px) {
.widget-area.grid-20 {
display: none;
}
.widget-area.grid-25 {
display: none;
}
.content-area.grid-55 {
width: 100%;
}
.tablet-push-20 {
left: initial;
}
.one-container.both-sidebars .site-main,
.one-container.both-right .site-main {
margin:0;
}
}July 25, 2017 at 9:31 am #354673Tom
Lead DeveloperLead DeveloperHi Roman,
I’m not too sure what you mean – any chance you can open a new topic with some more info/examples?
Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.