How to Control Your Storefront Sidebar on Mobile Devices
Content
A common challenge for Storefront theme users is managing the sidebar's behavior on mobile devices. By default, the theme shifts the sidebar to the bottom of the page on smaller screens to prioritize content. While this is a standard responsive design practice, it's not always ideal, especially if your sidebar contains crucial elements like product filters or navigation.
This guide will walk you through the most common solutions for controlling your Storefront sidebar on mobile, from simply hiding it to reordering its placement.
Why Does This Happen?
The Storefront theme uses CSS media queries to change the site's layout at specific screen widths (breakpoints). On desktop, the sidebar typically sits beside the main content. On mobile (usually below 768px), the theme stacks these elements vertically to ensure everything remains readable. The main content is placed first in the HTML structure for SEO and usability, which is why the sidebar appears at the bottom.
Common Solutions
1. Hide the Sidebar on Mobile
If the sidebar content isn't essential for mobile users, the simplest solution is to hide it entirely. This can be done by adding a small snippet of CSS code.
How to do it:
- Navigate to Appearance > Customize > Additional CSS in your WordPress dashboard.
- Paste the following code:
@media only screen and (max-width: 768px) {
#secondary.widget-area {
display: none;
}
} - Click Publish to save your changes.
This code tells mobile devices with a screen width of 768 pixels or less not to display the sidebar.
2. Reorder the Sidebar to Appear at the Top on Mobile
For situations where your mobile sidebar must be visible—such as when it contains important filters—you can use CSS Flexbox to change its order and move it above the main content.
How to do it:
- Go to Appearance > Customize > Additional CSS.
- Paste the following code. The
max-widthvalue targets mobile devices, and theorderproperties control the sequence of elements.@media (max-width: 768px) {
.site-content .col-full {
display: flex;
flex-direction: column;
}
.site-content .col-full #primary {
order: 2;
}
.site-content .col-full #secondary {
order: 1;
}
} - Click Publish.
Important Note: This method will apply the change to all pages. To target a specific page, like just the homepage, you may need to add a specific body class (e.g., .home) to the CSS selector for more precise control.
3. Adjust the Sidebar Width
In some cases, a sidebar might be too wide for certain laptop screens, causing it to drop to the bottom prematurely. You can adjust its minimum width to prevent this.
Example CSS:@media (min-width: 768px) {
.right-sidebar .widget-area {
min-width: 300px;
}
}
Troubleshooting Tips
- CSS Not Working? If your custom CSS stops working after an update, clear your site's cache and browser cache. The core class names for the sidebar (
#secondary,.widget-area) are stable, but it's good practice to double-check with your browser's inspector tool if issues arise. - Unexpected Layout Changes: Rearranging elements with CSS can sometimes have unintended consequences on other parts of your layout. Always test changes on different devices and pages.
- Plugin Conflicts: As seen in one thread, a conflicting plugin was causing layout issues on the cart page. If you encounter strange behavior, try disabling plugins one by one to identify a potential conflict.
By using these CSS techniques, you can gain greater control over how your Storefront theme adapts to mobile devices and ensure a better experience for your users.
Related Support Threads Support
-
How i can increase de width of the sidebar to 300px?https://wordpress.org/support/topic/how-i-can-increase-de-width-of-the-sidebar-to-300px/
-
Increase content width on layout with sidebarhttps://wordpress.org/support/topic/increase-content-width-on-layout-with-sidebar/
-
Bar bottom with the account, search & the cart disappear mobile version…https://wordpress.org/support/topic/bar-bottom-with-the-account-search-the-cart-disappear-mobile-version/
-
How to hide a top bar on mobile and tablet?https://wordpress.org/support/topic/how-to-hide-a-top-bar-on-mobile-and-tablet-2/
-
How can I move the sidebar (on mobile devices) after the category descriptionhttps://wordpress.org/support/topic/how-can-i-move-the-sidebar-on-mobile-devices-after-the-category-description/
-
Sidebar at the bottomhttps://wordpress.org/support/topic/sidebar-at-the-bottom-6/
-
Sidebar widthhttps://wordpress.org/support/topic/sidebar-width-80/
-
Whatsapp button being blocked by bottom barhttps://wordpress.org/support/topic/whatsapp-button-being-blocked-by-bottom-bar/
-
How to hide Sidebar in Tablet & Mobile View Storefront Themehttps://wordpress.org/support/topic/how-to-hide-sidebar-in-tablet-mobile-view-storefront-theme/
-
Adaptive Padding for Mobilehttps://wordpress.org/support/topic/adaptive-padding-for-mobile/
-
Side Bar Widget + Mobile Friendlyhttps://wordpress.org/support/topic/side-bar-widget-mobile-friendly/
-
Buddyboss sidebarshttps://wordpress.org/support/topic/buddyboss-sidebars/
-
side bar widgets in mobile viewhttps://wordpress.org/support/topic/side-bar-widgets-in-mobile-view/
-
sidebar on left and righthttps://wordpress.org/support/topic/sidebar-on-left-and-right/
-
Handheld footerhttps://wordpress.org/support/topic/handheld-footer/
-
Adding Custom Links to Mobile Footer Barhttps://wordpress.org/support/topic/adding-custom-links-to-mobile-footer-bar/
-
Order of elements on mobilehttps://wordpress.org/support/topic/order-of-elements-on-mobile/
-
Separator bar for mobile viewhttps://wordpress.org/support/topic/separator-bar-for-mobile-view/
-
Footer widgets overlapping on mobilehttps://wordpress.org/support/topic/footer-widgets-overlapping-on-mobile/
-
Mobile view – widget sidebar on tophttps://wordpress.org/support/topic/mobile-view-widget-sidebar-on-top/
-
Left Sidebar to Stack on top of woo Shophttps://wordpress.org/support/topic/left-sidebar-to-stack-on-top-of-woo-shop/
-
Move side bar Widget Storefront theme only for mobilehttps://wordpress.org/support/topic/move-side-bar-widget-storefront-theme-only-for-mobile/
-
WooCommerce demo store noticehttps://wordpress.org/support/topic/woocommerce-demo-store-notice/
-
Stick footer to bottom when page content is shorthttps://wordpress.org/support/topic/stick-footer-to-bottom-when-page-content-is-short/
-
Moving sidebar to top in mobile instead being bottom as defaulthttps://wordpress.org/support/topic/moving-sidebar-to-top-in-mobile-instead-being-bottom-as-default/
-
Alda’s travel bloghttps://wordpress.org/support/topic/aldas-travel-blog/
-
sidebar widget removal from my account pagehttps://wordpress.org/support/topic/sidebar-widget-removal-from-my-account-page-2/
-
Woocommerce Basket is half screen on mobile devicehttps://wordpress.org/support/topic/woocommerce-basket-is-half-screen-on-mobile-device/