How to structure WordPress plugin to display data from API
-
I am creating a plugin that connects to a remote API that has car listings and displays the data that’s returned in that call.
The plugin essentially does not need to interact with the WordPress database at all.
I already know I can use things like
wp_remote_get
,file_get_contents
andfile_get_contents
to retrieve that data.My problem is that I’m not sure if I should be creating a plugin for this or just shortcodes or page-templates or what.
I want the urls to look like
`example.com/cars/ //Cars listing results
example.com/cars/2 //Page 2 of Cars listing results
example.com/cars/?doors=4&engine=v8 //Search parameters for Cars listing results
example.com/car/1234 //Car info page 1234 is the car_id`I was thinking I could create pages in WordPress called
cars
andcar
and then create custom shortcodes that would hook into some functions I build to interact with the API, but for some reason that doesn’t seem like the best idea to me.Can anyone recommend a better structure for setting this up?
- The topic ‘How to structure WordPress plugin to display data from API’ is closed to new replies.