Tag: add_shortcode
Using Shortcodes for Plug-ins in WordPress
by WeblashAdmin on Sep.05, 2009, under Uncategorized, WordPress, development, plug-ins
First step: read the shortcode API reference in WordPress Codex. I had a difficult time figuring out exactly where to place the “add_shortcode” function call.
Second step: Place the “add_shortcode(‘shortcut name’, ‘shortcut function’);” to the same place you put your add_action and add_filter calls — I’m basing this off the excellent tutorial I found — “How to Write a WordPress Plug-in“:
//add actions
add_action('admin_menu', 'DevloungePluginSeries_ap');
add_action('wp_head', array(&$dl_pluginSeries, 'addHeaderCode'), 1);
add_action('activate_devlounge-plugin-series/devlounge-plugin-series.php', array(&$dl_pluginSeries, 'init'));
//Filters
add_filter('the_content', array(&$dl_pluginSeries, 'addContent'),1);
add_filter('get_comment_author', array(&$dl_pluginSeries, 'authorUpperCase'));
//Shortcodes
add_shortcode('shortcodename', array(&$dl_pluginSeries, 'function'));













