Hello
I want to put a sidebar on top of a page on mobile screen.
The sidebar is put on bottom of the page automatically.
I checked a past post below and tried same, but it doesn’t work.
This is URL.
https://sindb.com/online_shop
Will you tell me how to do that?
Thank you
Shoko
if you only want that for mobile do this to functions.php of your child-theme
if you like to have it for small screens you have to work with a different if clause ( if ($(window).width() < 768) {
function change_position(){
if(wp_is_mobile()){
?>
<script>
(function($){
$('aside').insertBefore('main.content');
})(jQuery);
</script>
<?php
}
}
add_action('wp_footer', 'change_position');
PS: to work with the flex-box model is also a good idea.
this is better – and comes to quick css:
@media only screen and (max-width:767px) {
.responsive #top.woocommerce-page #main .sidebar {
display: block;
border-color: transparent;
}
.responsive #top.woocommerce-page #main .sidebar .inner_sidebar {
margin-left: 0;
}
.responsive #top.woocommerce-page #wrap_all .container_wrap_first .container {
display: flex;
flex-direction: column-reverse;
}
}
Hello Guenni007
Thank you for your great help!
It works properly!
Thank you again.
Shoko
Thanks too for the positive feedback
Hi Shoko,
Great, glad you got it working and thanks to @guenni007 for helping out :-)
Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
Rikard
Hi Rikard
Please close this topic.
Thank you
Shoko
Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon