Created
October 17, 2022 03:47
-
-
Save codersaiful/ea65f0e889e5dc8d8c09a0eb6d5cd280 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: Create Table in WP Database | |
| * Plugin URI: https://wooproducttable.com/pricing/?utm_source=WPT+Plugin+Dashboard&utm_medium=Free+Version | |
| * Description: (WooproductTable) WooCommerce product table plugin helps you to display your products in a searchable table layout with filters. Boost conversions & sales. Woo Product Table is best for Wholesale. | |
| * Author: CodeAstrology Team | |
| * Author URI: https://wooproducttable.com/?utm_source=WPT+Plugin+Dashboard&utm_medium=Free+Version | |
| * Tags: woocommerce product list,woocommerce product table, wc product table, product grid view, inventory, shop product table | |
| * | |
| * Version: 3.2.4 | |
| * Requires at least: 4.0.0 | |
| * Tested up to: 6.0.2 | |
| * WC requires at least: 3.0.0 | |
| * WC tested up to: 7.0.0 | |
| * | |
| * | |
| * Text Domain: wpt_pro | |
| * Domain Path: /languages/ | |
| */ | |
| class Custom_Table{ | |
| public function __construct(){ | |
| add_action('init',[$this, 'create_custom_table']); | |
| // register_activation_hook( __FILE__, [$this, 'create_custom_table'] ); | |
| } | |
| public function create_custom_table(){ | |
| global $wpdb; | |
| $mytables=$wpdb->get_results("SHOW TABLES"); | |
| var_dump($mytables); | |
| // for charset | |
| $charset = $wpdb->get_charset_collate(); | |
| var_dump($charset); | |
| // give a table name here | |
| $table_name = $wpdb->prefix."a_custom_table"; | |
| // write custom Query Here | |
| $sql = "CREATE TABLE IF NOT EXISTS `$table_name` ( | |
| id mediumint(9) NOT NULL AUTO_INCREMENT, | |
| name tinytext NOT NULL, | |
| phone varchar(20) NOT NULL, | |
| eamil varchar(55) NOT NULL, | |
| PRIMARY KEY (id) | |
| )"; | |
| require_once ABSPATH . 'wp-admin/includes/upgrade.php'; | |
| dbDelta($sql); | |
| update_option('slskd','sddkdkd'); | |
| } | |
| } // end Custom_Table class here | |
| new Custom_Table(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment