Quick Start – How I did it
-
The following example code is in the functions.php of my child theme. NOT the main theme’s functions.php, as that can get wiped when the theme is updated.
// Setup table only if on WP admin page, and user has minimum rights if (( is_admin() and (current_user_can('manage_options')) )) // Make sure plugin function is available if ( function_exists('add_db_table_editor') ) { // Since my tables use same prefix as WP tables, add it. $table_name = $wpdb->prefix . "cities"; // call the function and set array values for this table add_db_table_editor(array( 'title'=>'Cities Maintenance', 'table'=>$table_name, // Use prefixed table name! 'id_column'=>'cityid', 'cap'=>'manage_options', 'editcap'=>'manage_options', // Be sure to use prefixed tablename in sql statement! 'sql'=>'SELECT * FROM ' . $table_name . ' ORDER BY cityname ASC' )); } // Done!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Quick Start – How I did it’ is closed to new replies.