You appear to be a bot. Output may be restricted
Description
Create an oik_shortcode programmaticallyCreating a shortcode programmatically involves
- Check the code is not already defined
- If it is then we use the $post ID for the parameters
- If not then we create the shortcode
- a. Which may require us to create the API that implements the shortcode
- b. Which suggests we should also consider creating the plugin in the first place ?
- For each specified parameter (either through interface or shortcode__syntax) insert an oik_sc_param
- $plugin
- ( ID ) required – the plugin noderef
- $code
- ( string ) required – the required shortcode ( excluding the square brackets )
- $help
- ( string ) required – short description
- $func
- ( string ) required – the implementing API
Usage
$ID = _oiksc_create_shortcode( $plugin, $code, $help, $func );
Parameters
Returns
ID post ID of the oik_shortcode postSource
File name: oik-shortcodes/admin/oik-shortcodes.phpLines:
1 to 12 of 12
function _oiksc_create_shortcode( $plugin, $code, $help, $func ) { p( "Creating shortcode $code - $help" ); $post = oiksc_get_shortcode_byname( $plugin, $code ); bw_trace2( $post, "post", true, BW_TRACE_VERBOSE ); if ( !$post ) { $post_id = oiksc_create_oik_shortcode( $plugin, $code, $help, $func ); } else { $post_id = $post->ID; } bw_backtrace(); return( $post_id ); }View on GitHub