You appear to be a bot. Output may be restricted
Description
Register custom post type "oik_shortcodes"The title should contain the shortcode name In the content the text before the <!–more –> should be the shortcode's short description The rest of the content should show the syntax, examples, links to APIs etc Some of this is autogenerated using shortcodes.
- Post type support of "publicize" enables publicizing using JetPack.
- Post type support of 'author' enables support for oik-user
- Post type support of 'revisions' allows for mistakes
Usage
oik_register_oik_shortcodes();
Parameters
Returns
voidTO DO
is query_var requiredSource
File name: oik-shortcodes/oik-shortcodes.phpLines:
1 to 50 of 50
function oik_register_oik_shortcodes() { $post_type = 'oik_shortcodes'; $post_type_args = array(); $post_type_args['label'] = 'Shortcodes'; $post_type_args['description'] = 'Shortcode definitions'; $post_type_args['has_archive'] = true; $post_type_args['supports'] = array( 'title', 'editor', 'revisions', 'author', 'publicize', 'clone', 'author' ); // Not using query_var for this post type // $post_type_args['query_var'] = "oik-shortcodes"; $post_type_args['show_in_rest'] = true; $post_type_args['show_in_nav_menus'] = false; bw_register_post_type( $post_type, $post_type_args ); //add_post_type_support( $post_type, 'publicize' ); //add_post_type_support( $post_type, 'author' ); //add_post_type_support( $post_type, 'revisions' ); bw_register_field( "_oik_sc_code", "text", "Shortcode" ); bw_register_field( "_oik_sc_plugin", "noderef", "Plugin ref", array( "#type" => array( "oik-plugins", "oik-themes" ) ) ); //bw_register_field( "_oik_sc_func", "noderef", "API ref", array( "#type" => "oik_api", "#theme" => false, '#form' => false )); bw_register_field( "_oik_sc_func", "sctext", "API ref", array( "#type" => "oik_api", "#theme" => true, '#theme_null' => false ) ); bw_register_field( "_oik_sc_example_cb", "checkbox", "Generate the programmed example?", array( "#theme" => false ) ); bw_register_field( "_oik_sc_live_cb", "checkbox", "Generate examples using Live data?", array( "#theme" => false ) ); bw_register_field( "_oik_sc_snippet_cb", "checkbox", "Generate snippets?", array( "#theme" => false ) ); bw_register_field( "_oik_sc_endcode_cb", "checkbox", "Enclosed content shortcode? Needs [<i>/code</i>]?" ); $the_title_args = array( "#callback" => "bw_get_shortcode_expands_in_titles" , "#parms" => "_oik_sc_code" , "#plugin" => "oik" , "#file" => "shortcodes/oik-codes.php" , "#form" => false , "#hint" => "virtual field" ); bw_register_field( "_oik_sc_the_title_cb", "virtual", "Expands in 'the_title'?", $the_title_args ); //bw_register_field( "_oik_sc_shortcake_cb", "checkbox", "Compatible with shortcake?" ); bw_register_field_for_object_type( "_oik_sc_code", $post_type ); bw_register_field_for_object_type( "_oik_sc_plugin", $post_type ); bw_register_field_for_object_type( "_component_version", $post_type ); bw_register_field_for_object_type( "_oik_sc_func", $post_type ); bw_register_field_for_object_type( "_oik_sc_example_cb", $post_type ); bw_register_field_for_object_type( "_oik_sc_live_cb", $post_type ); bw_register_field_for_object_type( "_oik_sc_snippet_cb", $post_type ); bw_register_field_for_object_type( "_oik_sc_endcode_cb", $post_type ); bw_register_field_for_object_type( "_oik_sc_the_title_cb", $post_type ); //bw_register_field_for_object_type( "_oik_sc_shortcake_cb", $post_type ); add_filter( "manage_edit-{$post_type}_columns", "oik_shortcodes_columns", 10, 2 ); add_action( "manage_{$post_type}_posts_custom_column", "bw_custom_column_admin", 10, 2 ); }View on GitHub