• Hello,

    I hope I get some answers with this post – I’m searching now for a few days. There are a lot of tutorials on how to start with plugin development and how to create subpages in the backend and how to create custom post types as well es custom taxonomies. But somehow I couldn’t find any tutorial which explains how to create, access, read, filter, sort, add, delete data within a custom table.

    My scenario right now is pretty straight forward – I pretty much went through all tutorials from this channel – which showed me also a nice part on how to be more structured and how to use php composer within plugin development -> Alecaddd I also work now with Classes and Controller Classes as well as with templates. So far so good.

    So to come back to my scenario:
    1) I have a custom database table created during activation
    2) I have an activated plugin with sub pages
    3) I can access sub pages and show some straight forward HTML content
    4) I already have some tabs to navigate within the subpage (first tab should show all data as a html table, second tab should show a form to enter data which will be submitted to the table)
    5) I want to access the database custom table and read / show the data on a sub page
    6) I want to write data to the database custom table with the form

    And this is were I don’t have any clue how to start with! So, I really hope that somebody can share a link to a tutorial on how to do that.

    To create the form – of course – I could just use the standard HTML syntax to create a native form and also create some PHP variables to fill the form fields in case of an edit. But would this be the right approach?

    Many thanks in advance.
    Best Regards
    Aaren

    • This topic was modified 6 years, 7 months ago by aaren. Reason: added database custom table
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Using standard HTML and PHP on an admin sub-page is fine. WP does have the WP_List_Table class which is used to generate the various admin object tables. You can extend this for your own needs if you like, then your table will be well integrated with other WP admin pages. Learning to use it is rather involved, there is little documentation, you need to mostly rely upon the source code for other object types for guidance.

    And of course you can use the global $wpdb object to access custom DB tables much like it’s used to access standard WP tables. Its use is not required, but it has already opened a DB connection, so you may as well use it.

Viewing 1 replies (of 1 total)

The topic ‘Show data from custom table in admin subpage’ is closed to new replies.