Using wordpress as a CMS and localization service - wordpress

We're building multiple single page apps that all consume the same service based API. One of our requirements is to offer a simple CMS that allows an admin to create marketing pages.
I was able to set up a wordpress instance using the multisite plugin and put it behind our own API. This allows us to use wordpress as a CMS service. We can create pages in the wordpress admin area and then pull the content in using the wordpress rest api plugin.
One of the problems I'm having is to migrate our key, value translation string files into wordpress. We'd like to store them in the database and use wordpress as a place to edit them and then query for them using the rest api plugin. Our translation files are json format and look like this:
{
"LOGIN_LABEL": "Sign In",
"LOGOUT_LABEL": "Sign Out",
"SIGN_UP_LABEL": "Register"
}
Looking for any solutions that would help us use wordpress as a place to store key value pairs, edit them, and do GET requests to pull them in.

Related

How to add Wordpress plugins to static (non-Wordpress) web sites?

Suppose I want to add some Wordpress plugins (e.g. Easy Appointment) to a few static web sites that do not run on Wordpress. Currently, I want to add just basic plugin features (appointment form and calendar) to my sites. In future, I would like also to add plugins for email notification, payments, etc.
My sites consist of a few HTML and JS files. I will probably need to use some cloud database or CMS but I don't want to move the sites to Wordpress. What is the best way to integrate Wordpress plugins with these static web sites ?
You Can't Do Thatâ„¢.
Without WordPress there's nothing to run your WordPress plugin code: no php, no way to load it, no way to invoke its features. And there's no database to hold your data (both appointment forms and calendars are data-intensive applications.)
Could some sort of headless WordPress instance be used with its REST API? Probably not: most plugins generate the HTML, Javascript, and CSS to provide their functionality within WordPress pages. Few support the REST API, and those that do use it for limited purposes.
You can embed a calendar from another calendar web app (like Google's calendar) in your static site easily. If you can find an app that offers a way to embed forms you can use that too. Try searching for appointment app to embed in static web site and you'll find some candidates.

I'm trying to implement external REST APIs in my wordpress website. Can anybody have idea how to do it (whether with a plugin or with programming)

I tried to use one plugin called "WP Data Sync". I am also going through its documentation/ support for the same. I am also having wpbakery page builder in my website. So is there any way that we sync with that also?
Note - We have to sync data in the form of images, image gallery, events listing, and the blog posts.
Did you check out WP Data Syncs website at https://wpdatasync.com/ and create an account to check out an API key?
I'm not sure about all APIs, but the ones I've used in the past would require me to register with the API's website, get issued an API key and maybe even designate the key to a specific website (your WordPress site in this case) for security reasons. After that, you would then go to your WP site and setup the API there via WP DataSyncs plugin.
I hope I understood your question and that this helps.

Wordpress plugin service page

have spent hours of researching understanding the correct approach for developing plugin for wordpress which does have custom "service" URL.
So far done:
plugin registers custom capabilities and role
inits the db and entries using $wpdb
create rest-api hook that could be used with JS
Should do:
Only the users with custom role "service" shall have access to a service dashboard.
the service dashboard shall make use of $wpdb to query data from the db.
I am looking badly for a simple example to learn from which shows a custom page that isn't integrated into WP posts or the admin panel.
Something that does check current user and allow access for given role to e.g. "www.awesome-wp-page.com/myplugin/main" and load some further data later as e.g. "www.awesome-wp-page.com/myplugin/stats/1234"
Originally I wanted WP to query the data via its own custom restapi, but also did not find any examples that query rest-api within WP (providing nonce etc) as simple example.
I found a lot examples for admin panels, adding links to post etc, but to my surprise not really some examples which do load simple (form) page or do a quick custom DB query and show the results on a static link.
Any help is appreciated

Wordpress retrieving data from Cakephp

I run a website where I have both Wordpress and Cakephp installed in the same domain.
Cakephp is the administrative backend to maintain and create business listings (like the yellow pages).
Wordpress is the front end for the public website.
I'm creating custom Wordpress templates to display the business listings from Cakephp, but am not sure how Wordpress is going to retrieve data from Cakephp.
I already have a bunch of Controller Actions that return json array with data that I would like to call from Wordpress. I don't want to duplicate in Wordpress data retrieval code that I've already written in Cakephp. But i'm not sure how in Wordpres would i make calls to these Cakephp Controller / Actions.
What is the recommended / best way to have Wordpress retrieve data from the Cakephp backend given at they are on the same domain? What other options do i have?
What is the recommended / best way to have Wordpress retrieve data
from the Cakephp backend given at they are on the same domain? What
other options do i have?
Access the DB directly, I'm not sure how to do that with Wordpress fugly API and code, but I'm pretty sure you can instantiate a new DB object with a connection to the CakePHP apps database. The WP API documentation will tell you how to do it I guess, if not it sucks more than I thought.
An alternative would be to expose the data via a RESTful service and consume it from Wordpress. If you return JSON you could even simply use a JS widget on a WP page to retrieve and render the data with pure JS.
As burzum suggested you have 2 real options.
WordPress does have a class for interacting with a DB called WPDB and will give you access to a few ways of querying the data in your CakePHP app. WordPress WPDB Class. It is by no means perfect but will do the job.
However you much better creating a custom WordPress plugin to parse and format the JSON as burzum suggested interacting via your own API. You could then if needed make this a 2 way communication allowing your WordPress install to make changes as necessary to yoru Cake app.

Single signon using WP database

I have a SaaS application/widget, which people can add to their website via an iframe. Is it possible to use wordpress as a single signon point, so that people who login at a wordpress site, are also logged in at my widget? Like a bridge of some sort.

Resources