You appear to be a bot. Output may be restricted
Description
Programmatically create an oik_api record for a selected plugin's funcNote: We don't allow comments on APIs. Instead we may add an oik_api_example in the same way as we do for shortcode examples.
Usage
$ID = oiksc_create_oik_api( $plugin, $func, $file, $type, $title );
Parameters
- $plugin
- ( ID ) required – the ID of the plugin for which this API is being created
- $func
- ( string ) required – the function name ( may be in form class::funcname )
- $file
- ( string ) required – the implementing filename within the plugin e.g. "oik/shortcodes/oik-codes.php"
- $type
- ( string ) required – the API type – this may be null – in which case we'll have to discover this later
- $title
- ( string ) optional – the API title
Returns
ID the post ID of the newly created oik_api recordSource
File name: oik-shortcodes/admin/oik-shortcodes.phpLines:
1 to 32 of 32
function oiksc_create_oik_api( $plugin, $func, $file, $type, $title=null ) { //bw_backtrace(); $post_title = oiksc_oik_api_post_title( $func, $type, $title ); $post = array( 'post_type' => 'oik_api' , 'post_title' => $post_title , 'post_name' => $func , 'post_content' => "<!--more -->[bw_api]" , 'post_status' => 'publish' , 'comment_status' => 'closed' ); /* Set metadata fields */ $_POST['_oik_api_name'] = $func; oik_require( "shortcodes/oik-api-importer.php", "oik-shortcodes" ); $_POST['_oik_api_class'] = oikai_get_classref( $func, null, $plugin, $file ); $_POST['_oik_api_plugin'] = $plugin; $_POST['_oik_api_source'] = $file; oik_require( "admin/oik-files.php", "oik-shortcodes" ); $_POST['_oik_fileref'] = oiksc_get_oik_fileref( $plugin, $file ); $_POST['_oik_api_type'] = $type; // @TODO Find the correct way of setting WordPress-SEO metadata //$_POST['_yoast_wpseo_metadesc'] = $post_title; /* We don't know these values yet: _oik_api_example _oik_api_notes _oik_api_deprecated_cb */ $post_id = wp_insert_post( $post, TRUE ); bw_trace2( $post_id, "post_id", true, BW_TRACE_DEBUG ); return( $post_id ); }View on GitHub