• Resolved jeremyclose

    (@jeremyclose)


    Is there a way via PHP or WP Hooks to direct access the data in a TablePress table? I have a interactive element I need to have data that will need updated occasionally and felt this would be a convenient solution for.

    If this is possible, can you provide a couple tips or direction to documentation? I saw the shortcode solutions to directly link to specific cells, but I don’t think that will work as needed.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    For direct PHP access, I recommend to use the methods that TablePress uses in its controller. All relevant methods are defined in the models/model-table.php file and you could e.g. load a table via

    $table = TablePress::$model_table->load( $table_id );
    

    Regards,
    Tobias

    Thread Starter jeremyclose

    (@jeremyclose)

    Thanks for the quick response. I’ll see where that gets me!

    Is there a similar way to get all rows from a specific column, or the reverse?

    • This reply was modified 6 years, 1 month ago by jeremyclose.
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    this will give you the full table data (as a two-dimensional array in the $table['data'] array. To extract one column as an array, you could access $table['data'][ 3 ] (which would be the fourth column).

    Regards,
    Tobias

    Thread Starter jeremyclose

    (@jeremyclose)

    Thank you! I’ll check this out.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? I hope it helps!

    Best wishes,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Direct access to TablePress data’ is closed to new replies.