Here at Kinetic Thoughts, we have been working in partnership with another firm to produce some niche Wordpress plugins. Without getting to much into the "niche", I want to talk about a slight "gotcha" I found today in trying to hook up the WP_LIST_TABLE class to other tables in the $wpdb
Now, for 3 really great background information sources, I would suggest investigating the following:
1.) Download the Custom List Table Example and inspect fully (and read the comments!).
2.) Theme.fm's article on Column Hacking
3.) $wpdb's Class reference
Now, I am not going to get into give step by step code - there is enough in the above links to get you started. What I do want to give you is one of those small tidbits that sometimes are implied, but get missed.
If you were to copy and modify the Custom List Table Example and attempt to use the $data = $wpdb->results("select column1,column2,column3 from mytable"); you are going to get a couple of weird errors.
Why? Look closely at the $wpdb's link above. It is actually pointing to the function get_row(). Notice the 3 constants? Those determine the returned datatype. You want ARRAY_A. Simply change your code to: $data = $wpdb->results("select column1,column2,column3 from mytable", ARRAY_A);
That's it.
Nice, huh?
Jeff
1 comment:
Another informative blog… Thank you for sharing it… Best of luck for further endeavor too.
Piano Instructor san carlos
Post a Comment