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.

1 Answer 1


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 the cron job thing, well it's maybe a otmization for the future. I went down the path of doing it using shortcodes, so that I can put the content where I want, doing a wp_remote_post to fetch the data and kinda worked. Thanks for your tip about the styling it makes sense to keep content and css separated.
    – Keani
    Aug 5, 2021 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.