TransWikia.com

Whats the best Practice for using a different Theme for WebView Apps?

WordPress Development Asked by pukka on November 11, 2021

I want to setup an Android and iOS App that calls my WP site via WebView. Somehow, i wasn’t able to find the best way to do this via Google. First I was thinking about putting some Code in my functions.php that detects if I am a WebView App Visitor and then deliver another Theme. Then I thought about using the Multisite Function for this, but i believe this is not a good Idea since I am not really using two “different” Websites, for which this Function is, I just need different themes delivered.

So, what would the best Practice for this? Detect if the user is surfing with WebView and then change the Theme (which WP Function can do that?).

Note: I am trying to not use any Theme-Switcher Plugins for this since I want to keep the Plugin Bloat as small as possible.

Thanks!

UPDATE:
Since I think my Question was not well written…
The Website already is responsive for mobile users that visit the site with their regular mobile phone browser. My Goal is to to deliver a completely different theme for People that use a App that I am going to develop, since the App is going to work different than the regular website but still needs to grab the WP Posts – WebView App detection will be made via User Agent or similar.

2 Answers

My Solution now was:

1) Made my App send Custom HTTP Headers 2) Coded myself a WP Plugin that searches for these Headers with every called URL and then deliver another theme with two simple WP Filters.

With this Solution I did not had to use the Multisite feature, no Subdomain, no SEO Problems (so Far!), and of course no 10k$ App needed to make it look very nice!

I hope this is a little help for anybody who is searching for this.

Answered by pukka on November 11, 2021

hmm this is called responsive web design. Being responsive doesn't mean the UI has to be 100% the same.

Have your JS detect that you are in webview, maybe via user agent, and then set some appropriate class on the body element. design your webview design around that class.

Answered by Mark Kaplun on November 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP