Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
1.2k views
in Themes by
Is there a way to remove the sidebar (donut theme) when viewing via a mobile device?  It drops all of the categories and other sidebar items underneath the questions and I dont think it looks good.  On the snowflat theme, the mobile version has it where you have to click to make the sidebar pop out, that would be a nice option for the donut theme, just not sure if that would be an easy thing to do.

1 Answer

+3 votes
by
selected by
 
Best answer

In order to remove the sidepanel in mobile:

1. Edit file qa-theme/Donut-theme/qa-donut-layer.php

2. Add this:

if (qa_is_mobile_probably())
    return;

Immediately before this line:

https://github.com/amiyasahu/Donut/blob/23aab78a3837a29b38139af2e61e9c8f7df8c303/qa-theme/Donut-theme/qa-donut-layer.php#L407

Edit:

As you can see in the image the change gets applied, even using your device (note all the sidebar stuff such as the categories, search, etc is gone):

You can try a fresh installation of the theme and see if it works with it.

by
Thanks but it didn't seem to work.  It didn't do anything different.
by
You said: "when viewing via a mobile device". Have you actually tested it using a *mobile* device?
If you actually did, then navigate to this site: http://www.whoishostingthis.com/tools/user-agent and paste as part of your comment the content below the text "Your User Agent is:"
by
Yes, I tested it on my cell phone.

Your User Agent is:
Mozilla/5.0 (Linux; Android 6.0.1; XT1254 Build/MCG24.251-5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36
by
I've just tested faking your device and it still works (I've added the image... maybe you've made some changes in your theme/q2a/plugins that I haven't).
by
Seems to work now, not sure what the difference was when I tried it yesterday.  Anyway, thanks for the help! :)
...