まずはこちらを参照。→プラグインの作成(WordPress Codex 日本語版)
とりあえず、何らかのショートコードを定義するプラグイン。
PHPファイル。
<?php /* Plugin Name: Hoge hoge plugin Plugin URI: http://2nx.info Description: Hoge hoge description Author: nkm_pa Version: 1.0 Author URI: http://2nx.info */ function shortcode_Hoge($arg) { return 'hoge'; } // ショートコードの登録 add_shortcode('Hoge', 'shortcode_Hoge'); // JS/CSSを読み込む場合 wp_enqueue_script('nkm_hoge', plugins_url().'/nkm_hoge/nkm_hoge.js', array('jquery')); wp_enqueue_style('nkm_hohe', plugins_url().'/nkm_hohe/nkm_hohe.css'); ?>
wp_enqueue_style関数で呼び出される、jQueryを用いたJSのサンプル。
jQuery(document).ready(function($) { // anything here. $(window).bind('resize', function(){ console.log('reseized'); }); });