diff --git a/wp-jquery-datatable.php b/wp-jquery-datatable.php index e44e188..c78803c 100644 --- a/wp-jquery-datatable.php +++ b/wp-jquery-datatable.php @@ -7,6 +7,41 @@ * Version: 1.1.0 */ +register_activation_hook( __FILE__, 'wp_jdt_activate_plugin' ); +function wp_jdt_activate_plugin() { + + $fields = array( + 'wp_jdt_info', + 'wp_jdt_paging', +// 'wp_jdt_paging_type', +// 'wp_jdt_page_length', + 'wp_jdt_b_length_change', + 'wp_jdt_ordering', +// 'wp_jdt_order_row', +// 'wp_jdt_order_row_sort', + 'wp_jdt_searching', + ); + + foreach( $fields as $field ) { + $data = get_option( $field ); + if ( $data == FALSE ) { + update_option( $field, 'true' ); + } + } + + $data = get_option('wp_jdt_paging_type'); + ( $data == FALSE ) ? update_option( 'wp_jdt_paging_type', 'simple' ) : ''; + + $data = get_option('wp_jdt_page_length'); + ( $data == FALSE ) ? update_option( 'wp_jdt_page_length', '10' ) : ''; + + $data = get_option('wp_jdt_order_row'); + ( $data == FALSE ) ? update_option( 'wp_jdt_order_row', '0' ) : ''; + + $data = get_option('wp_jdt_order_row_sort'); + ( $data == FALSE ) ? update_option( 'wp_jdt_order_row_sort', 'desc' ) : ''; +} + add_action('admin_menu', 'wp_jdt_create_menu'); function wp_jdt_create_menu(){