How to structure WordPress plugin to display data from API

  • Unknown's avatar

    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 and file_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 and car 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?

  • Unknown's avatar

    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.