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_contentsandfile_get_contentsto 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_idI was thinking I could create pages in WordPress called
carsandcarand 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?
-
I can recommend you ask at wordpress.ORG instead of here, because WordPress.com blogs can’t use plugins, so there are few plugin developers here.
- The topic ‘How to structure WordPress plugin to display data from API’ is closed to new replies.