0

I want to display results in a table. Is it possible to use the wordpress tables like the one in the post and page section which shows all posts and pages in the admin section.

global $wpdb;
$table_name = $wpdb->prefix . "mydonationdata";

$sql = "SELECT * FROM ".$table_name."";
$results = $wpdb->get_results($sql) or die(mysql_error());

foreach( $results as $result )
{
    echo $result->First_Name;
    echo $result->Last_Name;
    echo $result->Amount;
    echo $result->Email;
}
1

Most of the complex tables in admin are produced using WP_List_Table class. Despite being formally private, it has been widely used by third party extensions for years now.

It's not exactly friendly to work with, so you should research it and consider if your requirements merit reusing it or just replicating markup to achieve same visual look.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.