WordPress Plugin Development - Dari pemula sampai manula, dari ide doang sampai jadi uang.
Slide ini dipresentasikan saat workshop IMMatic 2012. Sayang bagian live coding tidak ada di dalam slide ini dan hanya bisa diikuti peserta workshop. :)
Filter Hooks • Halaman Administrasi http://codex.wordpress.org/Writing_a_Plugin Kalau rilis free, ndak masalah kalau minta uang donasi Sunday, July 8, 2012
URI: http://halaman-‐web.com/plugin-‐anda Description: Deskripsi plugin anda Version: Versi Plugin anda, misal: 1.0 Author: Nama Ente Author URI: http://alamat-‐web-‐anda.com License: Lisensi, kalau dirilis free pakai GPL, kalau endak, bisa dicopyright aja. */ ?> nama-plugin.php <?php /* Copyright YEAR PLUGIN_AUTHOR_NAME (email : PLUGIN AUTHOR EMAIL) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. 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 */ ?> License? Tinggal Ctrl+C + Ctrl+V ajah. http://www.idea.org/blog/2011/07/22/open-source-vs- proprietary-software/ Sunday, July 8, 2012
URI: http://halaman-‐web.com/plugin-‐anda Description: Deskripsi plugin anda Version: Versi Plugin anda, misal: 1.0 Author: Nama Ente Author URI: http://alamat-‐web-‐anda.com License: Lisensi, kalau dirilis free pakai GPL, kalau endak, bisa dicopyright aja. */ ?> nama-plugin.php <?php /* Copyright YEAR PLUGIN_AUTHOR_NAME (email : PLUGIN AUTHOR EMAIL) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. 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 */ ?> License? Tinggal Ctrl+C + Ctrl+V ajah. http://www.idea.org/blog/2011/07/22/open-source-vs- proprietary-software/ Sunday, July 8, 2012
wp_footer, di bawah halaman sebelum </body> • user_register, dieksekusi setelah pendaftaran • Selengkapnya: • http://codex.wordpress.org/Plugin_API/ Action_Reference Ada sekitar 587 Action Hooks yang ada di wp Sunday, July 8, 2012
visitor. Kita bisa memodifikasi isi tulisan sebelum tampil memakai filter ini. • wp_insert_post_data, kita bisa memodifikasi isi tulisan sebelum masuk ke database. • Selengkapnya: http://codex.wordpress.org/ Plugin_API/Filter_Reference Sunday, July 8, 2012
'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' ); } function my_plugin_options() { ! if ( !current_user_can( 'manage_options' ) ) { ! ! wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); ! } ! echo '<div class="wrap">'; ! echo '<p>Here is where the form would go if I actually had options.</p>'; ! echo '</div>'; } ?> Action! Menambahkan Menu di Admin Tampilkan Menu 1 2 3 Sunday, July 8, 2012
'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' ); } function my_plugin_options() { ! if ( !current_user_can( 'manage_options' ) ) { ! ! wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); ! } ! echo '<div class="wrap">'; ! echo '<p>Here is where the form would go if I actually had options.</p>'; ! echo '</div>'; } ?> Action! Menambahkan Menu di Admin Tampilkan Menu 1 2 3 Wah gitu doang ya! Ho oh, cyiiin! Sunday, July 8, 2012
WordPress • Buat wp-content/plugins/nama-plugin/nama- plugin.php <<=== misal: Filter-Porn • Buat Informasi & Lisensi • Buat Action / Filter Sunday, July 8, 2012