Show dynamic list of products from custom api of another database under same host

This is the time of question where I don't know even where to start, so i'll describe what I have and what I want, so that someone maybe could give me a direction to go. I'm not asking for code, just for what approach to take.

What I have
I have a Wordpress website, with some static content and stuff, all content was added via the public available plugins and the easy to use customizer.

Also I have a custom built website in php which an android app uses to work, it has it's own database (under the same host that runs wordpress) and store all the info about products and users. there is no visuals the website works just as an api.

What I Want
I wonder how would I integrate the two, make a page where the wordpress website is able to list products from my custom api. How can I ( Or how should I ) run custom php inside of wordpress so that for example I could show a list of products fetched from the other database via my custom api.

I started to build a wordpress plugin where I would create a widget that does all this, but maybe someone who understands better how wordpress work should have a better way of doing things.

Topic custom-content plugin-development database Wordpress

Category Web


You have a couple of options for pulling external content into WordPress. Basically, you would either use a theme or a plugin. Since this deals with content it seems like the WordPress Way would be to use a plugin to pull in the content, and perhaps a theme or a child theme to style it.

There are many options for how to pull the content in. You could pull it in live, so every time a visitor comes to the site the Page (or whatever post type you use) lists out all the latest info from the external database. However, that approach could drain a lot of server resources, so you might instead wish to set up a cron job that pulls the info from the external database, into a custom table in the WP database, at a certain interval - say once a week, or once every night, however often you need to sync the data. You can then pull from the WP database itself and cache as needed.

At that point, you're likely to want to style things, so you will want to either create a custom theme or just a child theme that has a few extra CSS styles added in for the external content. This way you can keep the functionality in the plugin, but styling in the theme, so if you change themes later you keep the data pull and can just apply a new child theme if needed.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.