6. 世界はどうなのか?
プラグイン 有料プラン インストール数
Yoast SEO ○ 500万
WooCommerce ○ 500万
Contact Form 7 × 500万
Site Kit by Google × 300万
Elementor ○ 500万 (800万)
The 10 Most Popular Plugins on WordPress.com – WordPress.com News
27. AI時代はプラグイン開発がより?近に
<?php
/*
Plugin Name: My Notes Plugin
Description: Allows users to save notes in the database.
Version: 1.0
Author: Your Name
*/
// Plugin activation hook
register_activation_hook(__FILE__, 'my_notes_plugin_activate');
function my_notes_plugin_activate() {
// Create the database table for storing notes
global $wpdb;
$table_name = $wpdb->prefix . 'my_notes';
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE $table_name (
id INT(11) NOT NULL AUTO_INCREMENT,
note TEXT NOT NULL,
created_at DATETIME NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
// Add a menu item for the plugin in the WordPress admin dashboard
add_action('admin_menu', 'my_notes_plugin_menu');
function my_notes_plugin_menu() {
add_menu_page(
'My Notes',
'My Notes',
'manage_options',
'my-notes',
'my_notes_plugin_page',
'dashicons-edit',
20
);
}
// Callback function for the plugin menu page
function my_notes_plugin_page() {
// Handle form submission
if (isset($_POST['submit'])) {
$note = sanitize_textarea_field($_POST['note']);
// Insert the note into the database
global $wpdb;
$table_name = $wpdb->prefix . 'my_notes';
$wpdb->insert(
$table_name,
array(
'note' => $note,
'created_at' => current_time('mysql')
)
);
echo '<div class="notice notice-success"><p>Note saved successfully!</p></div>';
}
// Display the form for adding a new note
?>
<div class="wrap">
<h1>My Notes</h1>
<form method="post" action="">
<textarea name="note" rows="5" cols="50"></textarea><br>
<input type="submit" name="submit" value="Save Note" class="button button-primary">
</form>
</div>
<?php
}
POINT CopilotもChatGPTも使える