[page_heading customclass=””]プラグインの作成[/page_heading]
[subheading customclass=”light”]”trs_question”のプラグインを作成する場合[/subheading]
- /wp-content/plugins以下にフォルダを作成
my_hello (フォルダーの作成)
└trs_question.php
2、trs_question.phpにプラグイン情報を記載
/*
Plugin Name: (プラグインの名前)
Plugin URI: (プラグインの説明と更新を示すページの URI)
Description: (プラグインの短い説明)
Version: (プラグインのバージョン番号。例: 1.0)
Author: (プラグイン作者の名前)
Author URI: (プラグイン作者の URI)
License: (ライセンス名の「スラッグ」 例: GPL2)
*/
実際の記述は下記のとおり
——————————————–
/* Plugin Name: TimeRiverSystem Question Plugin URI: https://globalit-academy.com/ Description: It is a plug-in to implement the question system. Version: 0.001 Author: TimeRiverSystem,inc Author URI: https://globalit-academy.com/ License: GPLv2 */ /* Copyright 2014 Global IT Academy (email : tokikawa@globalit-academy.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
3、trs_question.phpにプラグイン情報を記載
管理画面の左側にメニューを表示して、
hello worldを表示するだけのコード
function add_course_list() { // add_menu_page('ページタイトル', 'メニュータイトル', '権限', 'メニュースラッグ', '呼び出し関数', 'アイコンURL', '表示位置'); add_menu_page('コース一覧', 'コース一覧', 0, 'trs_question', 'course_list', null, 1); } add_action('admin_menu', 'add_course_list'); // 実行メニューのリンク先で実行される関数 function course_list(){ echo '<h1>hello world</h1>'; }
プラグインを有効にすると、管理画面にメニューが表示され、
それをクリックすると、hello world と表示されるかと思います。
”グローバル人材育成”、”IT留学“のグローバルITアカデミーではこの様な、
wordpressのカスタマイズ方法も学ぶ事ができます。