If you want to continbue using OnsenUI, I suggest you ask their community how to use it to front-end a “headless” WP site: https://community.onsen.io/
Thread Starter
owllei
(@owllei)
@sterndata Thank you for the swift reply. Do you see any other workarounds? I have posted this on the OnsenUI forum but I fear that it will be awhile (if any) before I receive any responses.
Do you really need an app? Would a well-designed, responsive site work?
There are plugins that will let you use a 3rd party web app with WP, e.g., https://wordpress.org/plugins/apppresser/
If you want to roll your own, you’ll need to master the REST API: https://developer.wordpress.org/rest-api/
Thread Starter
owllei
(@owllei)
@sterndata Yes, we would like to have it as an app.
Could you install Onsen UI on the same server and access your app through a sub-domain? Unless you will have a headless WP installation, it’s impractical to have both under the same sub-domain. You can have your app manage all WP interaction through the WP REST API. No PHP is required. The API returns JSON data for all requests. https://developer.wordpress.org/rest-api/
Thread Starter
owllei
(@owllei)
@bcworkz Thanks for the suggestion. I was thinking about moving my JS, CSS, and HTML files over, but I was worried about the multiple JS, CSS, and HTML interacting with the current WordPress flow, especially the CSS files. Also, would plugins such as Paid Membership Pro be able to limit queries or visits to the app sub-domain if we went that route?
The way I imagine this is as two parallel installations. They use completely different resources, so there would be no conflicts with WP. For example, if WP were installed in the public root folder, the typical situation and reached by http://www.example.cοm; then Onsen could be installed in an /onsen/ folder, to which requests for m.example.cοm are sent. It’s really just like a separate site, except it is under the same server and domain.
Your app would get WP data through http://www.example.cοm/wp-json/v2/. If queries are limited in WP for its own front end, they should be limited for API queries as well, but it in part depends on the code used to limit queries. This scheme makes your app the equivalent of a remote app, so you would not be using cookie authentication. Your app would use one of the several API authentication plugins. I couldn’t say whether Paid Membership Pro is compatible with your chosen authentication plugin or not. You’d need to ask the Membership Pro devs. It should be compatible if the “authenticate” hook is used correctly.
I am currently developing a WordPress theme that uses media queries to deliver the onsen ui version to mobile devices. It’s been interesting as I’ve always just made a responsive web design. The basics are the media query hides all of the ons stuff in the footer in desktop widths and hides everything else but the ons stuff below a certain width. All the content is pulled via rest api and I push the history to the browser as I change pages.