Skip to content

Instantly share code, notes, and snippets.

@badabingbreda
Created December 1, 2020 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badabingbreda/1dc4c4018b09262adbd1ded1ba2b5256 to your computer and use it in GitHub Desktop.
Save badabingbreda/1dc4c4018b09262adbd1ded1ba2b5256 to your computer and use it in GitHub Desktop.
VSCode Meta Box code-snippets
{
// https://snippet-generator.app/
"Metabox meta_box": {
"prefix": "__mb_meta_box",
"body": [
"add_filter( 'rwmb_meta_boxes', '${1:my_new_metabox_callback}' );",
"/**",
" * Create a Meta Box, anonymously",
" */",
"function ${1:my_new_metabox_callback}( \\$meta_boxes ) {",
" \\$meta_boxes[] = array(",
" 'title' => '${2:Meta Box Name}',",
" 'id' => '${3:Meta BOx ID}',",
" 'post_types' => array(",
" '${4:post}',",
" ),",
" 'context' => 'normal', // normal / advanced / side / form_top / after_title / after_editor / before_permalink",
" 'priority' => 'high', // high / low",
" 'fields' => array(",
" // fields go here",
" $0",
" ),",
" );",
" return \\$meta_boxes;",
"}"
],
"description": "Metabox meta_box"
},
"Metabox Register Post Type": {
"prefix": "__mb_regposttype",
"body": [
"add_action( 'init', '${1:your_prefix_register_post_type}' );",
"",
"/**",
" * Register a CPT",
" */",
"function ${1:your_prefix_register_post_type}() {",
"",
" \\$args = array (",
" 'label' => esc_html__( '${2:Label}s', '${4:text-domain}' ),",
" 'labels' => array(",
" 'menu_name' => esc_html__( '${2:Label}s', '${4:text-domain}' ),",
" 'name_admin_bar' => esc_html__( '${2:Label}', '${4:text-domain}' ),",
" 'add_new' => esc_html__( 'Add new', '${4:text-domain}' ),",
" 'add_new_item' => esc_html__( 'Add new ${2:Label}', '${4:text-domain}' ),",
" 'new_item' => esc_html__( 'New ${2:Label}', '${4:text-domain}' ),",
" 'edit_item' => esc_html__( 'Edit ${2:Label}', '${4:text-domain}' ),",
" 'view_item' => esc_html__( 'View ${2:Label}', '${4:text-domain}' ),",
" 'update_item' => esc_html__( 'Update ${2:Label}', '${4:text-domain}' ),",
" 'all_items' => esc_html__( 'All ${2:Label}s', '${4:text-domain}' ),",
" 'search_items' => esc_html__( 'Search ${2:Label}s', '${4:text-domain}' ),",
" 'parent_item_colon' => esc_html__( 'Parent ${2:Label}', '${4:text-domain}' ),",
" 'not_found' => esc_html__( 'No ${2:Label}s found', '${4:text-domain}' ),",
" 'not_found_in_trash' => esc_html__( 'No ${2:Label}s found in Trash', '${4:text-domain}' ),",
" 'name' => esc_html__( '${2:Label}s', '${4:text-domain}' ),",
" 'singular_name' => esc_html__( '${2:Label}', '${4:text-domain}' ),",
" ),",
" 'public' => true,",
" 'exclude_from_search' => false,",
" 'publicly_queryable' => true,",
" 'show_ui' => true,",
" 'show_in_nav_menus' => true,",
" 'show_in_admin_bar' => false,",
" 'show_in_rest' => false,",
" 'menu_icon' => 'dashicons-admin-post',",
" 'capability_type' => 'post',",
" 'hierarchical' => false,",
" 'has_archive' => true,",
" 'query_var' => true,",
" 'can_export' => true,",
" 'rewrite_no_front' => false,",
" 'supports' => array(",
" 'title',",
" 'editor',",
" 'thumbnail',",
" ),",
" 'rewrite' => true,",
" );",
"",
" register_post_type( '${3:cptslug}', \\$args );",
"}",
"",
"$0",
""
],
"description": "Metabox Register Post Type"
},
"Metabox Register Taxonomy": {
"prefix": "__mb_regtaxonomy",
"body": [
"add_action( 'init', '${1:your_prefix_register_taxonomy}', 0 );",
"",
"/**",
" * Register a taxonomy",
" *",
" */",
"function ${1:your_prefix_register_taxonomy}() {",
"",
" \\$args = array (",
" 'label' => esc_html__( '${2:Label}s', 'text-domain' ),",
" 'labels' => array(",
" 'menu_name' => esc_html__( '${2:Label}s', 'text-domain' ),",
" 'all_items' => esc_html__( 'All ${2:Label}s', 'text-domain' ),",
" 'edit_item' => esc_html__( 'Edit ${2:Label}', 'text-domain' ),",
" 'view_item' => esc_html__( 'View ${2:Label}', 'text-domain' ),",
" 'update_item' => esc_html__( 'Update ${2:Label}', 'text-domain' ),",
" 'add_new_item' => esc_html__( 'Add new ${2:Label}', 'text-domain' ),",
" 'new_item_name' => esc_html__( 'New ${2:Label}', 'text-domain' ),",
" 'parent_item' => esc_html__( 'Parent ${2:Label}', 'text-domain' ),",
" 'parent_item_colon' => esc_html__( 'Parent ${2:Label}:', 'text-domain' ),",
" 'search_items' => esc_html__( 'Search ${2:Label}s', 'text-domain' ),",
" 'popular_items' => esc_html__( 'Popular ${2:Label}s', 'text-domain' ),",
" 'separate_items_with_commas' => esc_html__( 'Separate ${2:Label}s with commas', 'text-domain' ),",
" 'add_or_remove_items' => esc_html__( 'Add or remove ${2:Label}s', 'text-domain' ),",
" 'choose_from_most_used' => esc_html__( 'Choose most used ${2:Label}s', 'text-domain' ),",
" 'not_found' => esc_html__( 'No ${2:Label}s found', 'text-domain' ),",
" 'name' => esc_html__( '${2:Label}s', 'text-domain' ),",
" 'singular_name' => esc_html__( '${2:Label}', 'text-domain' ),",
" ),",
" 'public' => true,",
" 'show_ui' => true,",
" 'show_in_menu' => true,",
" 'show_in_nav_menus' => true,",
" 'show_tagcloud' => true,",
" 'show_in_quick_edit' => true,",
" 'show_admin_column' => false,",
" 'show_in_rest' => false,",
" 'hierarchical' => false,",
" 'query_var' => true,",
" 'sort' => false,",
" 'rewrite_no_front' => false,",
" 'rewrite_hierarchical' => false,",
" 'rewrite' => true,",
" );",
"",
" register_taxonomy( '${3:taxslug}', array( 'location' ), \\$args );",
"}",
"$0"
],
"description": "Metabox Register Taxonomy"
},
"Metabox Autocomplete": {
"prefix": "__mb_autocomplete",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'autocomplete',",
" // Options of autocomplete, in format 'value' => 'Label'",
" 'options' => array(",
" 'java' => 'Java',",
" 'javascript' => 'JavaScript',",
" 'php' => 'PHP',",
" 'c' => 'C',",
" 'cplusplus' => 'C++',",
" 'csharp' => 'C#',",
" 'objectivec' => 'Objective-C',",
" 'kotlin' => 'Kotlin',",
" 'swift' => 'Swift',",
" ),",
"),"
],
"description": "Metabox Autocomplete"
},
"Metabox Button": {
"prefix": "__mb_button",
"body": [
"array(",
"\t'name' => '${1:Field Label}',",
"\t'id'\t => '${2:field_name}',",
"\t'type'\t => 'button',",
"\t// Button text.",
"\t'std'\t\t=> '${3:Button Label}',",
"\t// Custom HTML attributes.",
"\t'attributes' => array(",
"\t\t'data-section' => 'advanced-section',",
"\t\t'class'\t\t=> 'class-trigger-name',",
"\t),",
"),"
],
"description": "Metabox Button"
},
"Metabox Button Group": {
"prefix": "__mb_bgroup",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'button_group',",
" 'options' => array(",
" 'bold' => '<i class=\"dashicons dashicons-editor-bold\"></i>',",
" 'italic' => '<i class=\"dashicons dashicons-editor-italic\"></i>',",
" 'underline' => '<i class=\"dashicons dashicons-editor-underline\"></i>',",
" ),",
" 'inline' => true, // true (horizontal) / false (vertical)",
" 'multiple' => true, // multiple choice",
"),"
],
"description": "Metabox Button Group"
},
"Metabox Checkbox": {
"prefix": "__mb_checkbox",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'checkbox',",
" 'std' => 1, // 0 or 1",
"),"
],
"description": "Metabox Checkbox"
},
"Metabox Checkbox List": {
"prefix": "__mb_checkbox_list",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'checkbox_list',",
" // Options of checkboxes, in format 'value' => 'Label'",
" 'options' => array(",
" 'java' => 'Java',",
" 'javascript' => 'JavaScript',",
" 'php' => 'PHP',",
" 'csharp' => 'C#',",
" 'objectivec' => 'Objective-C',",
" 'kotlin' => 'Kotlin',",
" 'swift' => 'Swift',",
" ),",
" // Display options in a single row?",
" // 'inline' => true,",
" // Display \"Select All / None\" button?",
" 'select_all_none' => true,",
"),"
],
"description": "Metabox Checkbox List"
},
"Metabox Color": {
"prefix": "__mb_color",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'color',",
" // Add alpha channel?",
" 'alpha_channel' => false, // true / false",
" // Color picker options. See here: https://automattic.github.io/Iris/.",
"// 'js_options' => array(",
"// 'palettes' => array( '#125', '#459', '#78b', '#ab0', '#de3', '#f0f' )",
"// ),",
"),"
],
"description": "Metabox Color"
},
"Metabox Custom HTML": {
"prefix": "__mb_html",
"body": [
"array(",
" // Field name: usually not used",
" 'type' => 'custom_html',",
" // HTML content",
" 'std' => '<div class=\"alert alert-warning\">This is a custom HTML content</div>',",
" // PHP function to show custom HTML",
" // 'callback' => 'display_warning',",
"),"
],
"description": "Metabox Custom HTML"
},
"Metabox Date": {
"prefix": "__mb_date",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'date',",
" // Date picker options. See here http://api.jqueryui.com/datepicker",
" 'js_options' => array(",
" 'dateFormat' => 'yy-mm-dd',",
" 'showButtonPanel' => false,",
" //'stepMinute' => 15,",
" //'showTimepicker' => true,",
" //'controlType' => 'select',",
" //'oneLine' => true,",
" ),",
" // Display inline?",
" 'inline' => false,",
" // Save value as timestamp?",
" 'timestamp' => true,",
"),"
],
"description": "Metabox Date"
},
"Metabox Divider": {
"prefix": "__mb_divider",
"body": [
"array(",
" 'type' => 'divider',",
"),"
],
"description": "Metabox Divider"
},
"Metabox Fieldset Text": {
"prefix": "__mb_fieldset_text",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'fieldset_text',",
"",
" // Options: array of key => Label for text boxes",
" // Note: key is used as key of array of values stored in the database",
" 'options' => array(",
" 'name' => 'Name',",
" 'address' => 'Address',",
" 'email' => 'Email',",
" ),",
"",
" // Is field cloneable?",
" 'clone' => true,",
"),"
],
"description": "Metabox Fieldset Text"
},
"Metabox File": {
"prefix": "__mb_file",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'file',",
"",
" // Delete file from Media Library when remove it from post meta?",
" // Note: it might affect other posts if you use same file for multiple posts",
" 'force_delete' => false,",
"",
" // Maximum file uploads.",
" 'max_file_uploads' => 1,",
"),"
],
"description": "Metabox File"
},
"Metabox File Advanced": {
"prefix": "__mb_file_advanced",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'file_advanced',",
"",
" // Delete file from Media Library when remove it from post meta?",
" // Note: it might affect other posts if you use same file for multiple posts",
" 'force_delete' => false,",
"",
" // Maximum file uploads.",
" 'max_file_uploads' => 1,",
" // File types.",
" // 'mime_type' => 'application,audio,video',",
" // Do not show how many files uploaded/remaining.",
" 'max_status' => false,",
"),"
],
"description": "Metabox File Advanced"
},
"Metabox File Upload": {
"prefix": "__mb_file_upload",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'file_upload',",
"",
" // Delete file from Media Library when remove it from post meta?",
" // Note: it might affect other posts if you use same file for multiple posts",
" 'force_delete' => false,",
"",
" // Maximum file uploads.",
" 'max_file_uploads' => 1,",
" // File types.",
" // 'mime_type' => 'application,audio,video',",
" // Do not show how many files uploaded/remaining.",
" 'max_status' => false,",
"),"
],
"description": "Metabox File Upload"
},
"Metabox Group": {
"prefix": "__mb_group",
"body": [
"array(",
" 'name' => '${1:Field Label}', // Optional",
" 'id' => '${2:field_name}',",
" 'type' => 'group',",
" 'clone' => true,",
" // Drag and drop clones to reorder them?",
" 'sort_clone' => true,",
" // Sub-fields",
" 'collapsible' => true, // true / false",
" 'save_state' => true, // true / false",
" 'default_state' => 'collapsed', // collapsed / expanded",
" 'fields' => array(",
" // sub-fields go here",
"",
" ),",
"),"
],
"description": "Metabox Group"
},
"Metabox Heading": {
"prefix": "__mb_heading",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'type' => 'heading',",
" 'desc' => '${2:Optional description}',",
"),"
],
"description": "Metabox Heading"
},
"Metabox Hidden": {
"prefix": "__mb_hidden",
"body": [
"array(",
" 'id' => '${1:field_name}',",
" 'type' => 'hidden',",
" // Hidden field must have predefined value",
" 'std' => '${2:Hidden Value}',",
"),"
],
"description": "Metabox Hidden"
},
"Metabox Image": {
"prefix": "__mb_image",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'image',",
" // Delete image from Media Library when remove it from post meta?",
" // Note: it might affect other posts if you use same image for multiple posts",
" 'force_delete' => false,",
" // Maximum image uploads",
" // 'max_file_uploads' => 2,",
"),"
],
"description": "Metabox Image"
},
"Metabox Image Advanced": {
"prefix": "__mb_image_advanced",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'image_advanced',",
" // Delete image from Media Library when remove it from post meta?",
" // Note: it might affect other posts if you use same image for multiple posts",
" 'force_delete' => false,",
" // Maximum image uploads",
" // 'max_file_uploads' => 2,",
" // Do not show how many images uploaded/remaining.",
" 'max_status' => 'false',",
" // Image size that displays in the edit page.",
" 'image_size' => 'thumbnail',",
"),"
],
"description": "Metabox Image Advanced"
},
"Metabox Image Select": {
"prefix": "__mb_image_select",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'image_select',",
" // Array of 'value' => 'Image URL' pairs",
" 'options' => array(",
" 'left' => 'http://placehold.it/90x90&text=Left',",
" 'right' => 'http://placehold.it/90x90&text=Right',",
" 'none' => 'http://placehold.it/90x90&text=None',",
" ),",
" // Allow to select multiple values? Default is false",
" // 'multiple' => true,",
"),"
],
"description": "Metabox Image Select"
},
"Metabox Image Upload": {
"prefix": "__mb_image_upload",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'image_upload',",
" // Delete file from Media Library when remove it from post meta?",
" // Note: it might affect other posts if you use same file for multiple posts",
" 'force_delete' => false,",
" // Maximum file uploads.",
" 'max_file_uploads' => 2,",
" // Do not show how many files uploaded/remaining.",
" 'max_status' => 'false',",
" // Image size that displays in the edit page.",
" 'image_size' => 'thumbnail',",
"),"
],
"description": "Metabox Image Upload"
},
"Metabox Key Value": {
"prefix": "__mb_key_value",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'key_value',",
" 'desc' => '${3:Add additional info below:}',",
"),"
],
"description": "Metabox Key Value"
},
"Metabox Map": {
"prefix": "__mb_map",
"body": [
"// Map Address field.",
"array(",
" 'name' => '${1:Map Address Label}',",
" 'id' => '${2:field_name}_address',",
" 'type' => 'text',",
"),",
"// Map field.",
"array(",
" 'name' => '${3:Map Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'map',",
" // Default location: 'latitude,longitude[,zoom]' (zoom is optional)",
" 'std' => '${4:-6.233406,-35.049906,15}',",
" // Address field ID",
" 'address_field' => '${2:field_name}_address',",
" // Google API key",
" 'api_key' => 'XXXXXXXXX',",
"),"
],
"description": "Metabox Map"
},
"Metabox Number": {
"prefix": "__mb_number",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'number',",
"",
" 'placeholder' => '${3:Enter a number}',",
" 'min' => 0,",
" // 'max' => 999,",
" 'step' => 1,",
"),"
],
"description": "Metabox Number"
},
"Metabox OSM": {
"prefix": "__mb_osm",
"body": [
"// OSM Address field.",
"array(",
" 'name' => '${1:Map Address Label}',",
" 'id' => '${2:field_name}_address',",
" 'type' => 'text',",
"),",
"// Map field.",
"array(",
" 'name' => '${3:Map Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'osm',",
"",
" // Default location: 'latitude,longitude[,zoom]' (zoom is optional)",
" 'std' => '${4:-6.233406,-35.049906,15}',",
"",
" // Address field ID",
" 'address_field' => '${2:field_name}_address',",
"),"
],
"description": "Metabox OSM"
},
"Metabox Password": {
"prefix": "__mb_password",
"body": [
"array(",
" 'name' => '${1:Field_Name}',",
" 'id' => '${2:Field_ID}',",
" 'type' => 'password',",
"),"
],
"description": "Metabox Password"
},
"Metabox Post": {
"prefix": "__mb_post",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'post',",
" // Post type.",
" 'post_type' => 'page',",
" // Field type.",
" 'field_type' => 'select_advanced', // select / select_advanced / select_tree / checkbox_list / checkbox_tree / radio_list",
" // Placeholder, inherited from `select_advanced` field.",
" 'placeholder' => '${3:Select a page}',",
" // Query arguments. See https://codex.wordpress.org/Class_Reference/WP_Query",
" 'query_args' => array(",
" 'post_status' => 'publish',",
" 'posts_per_page' => - 1,",
" ),",
"),"
],
"description": "Metabox Post"
},
"Metabox Radio": {
"prefix": "__mb_radio",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'radio',",
" // Array of 'value' => 'Label' pairs for radio options.",
" // Note: the 'value' is stored in meta field, not the 'Label'",
" 'options' => array(",
" 'value1' => 'Label1',",
" 'value2' => 'Label2',",
" ),",
" // Show choices in the same line?",
" 'inline' => false,",
"),"
],
"description": "Metabox Radio"
},
"Metabox Range": {
"prefix": "__mb_range",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'range',",
" 'min' => 0,",
" 'max' => 60,",
" 'step' => 5,",
"),"
],
"description": "Metabox Range"
},
"Metabox Relationship": {
"prefix": "__mb_relationship",
"body": [
"add_action( 'mb_relationships_init', function() {",
" MB_Relationships_API::register( array(",
" 'id' => '${1:field_label}',",
" 'from' => '${2:post}',",
" 'to' => '${3:page}',",
" ) );",
"} );"
],
"description": "Metabox Relationship"
},
"Metabox Select": {
"prefix": "__mb_select",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'select',",
" // Array of 'value' => 'Label' pairs",
" 'options' => array(",
" 'java' => 'Java',",
" 'javascript' => 'JavaScript',",
" 'php' => 'PHP',",
" ),",
" // Allow to select multiple value?",
" 'multiple' => true, // true / false",
" // Placeholder text",
" 'placeholder' => '${3:Select an item}',",
" // Display \"Select All / None\" button?",
" 'select_all_none' => true, // true / false",
"),"
],
"description": "Metabox Select"
},
"Metabox Select Advanced": {
"prefix": "__mb_select_advanced",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'select_advanced',",
" // Array of 'value' => 'Label' pairs",
" 'options' => array(",
" 'java' => 'Java',",
" 'javascript' => 'JavaScript',",
" 'php' => 'PHP',",
" ),",
" // Allow to select multiple value?",
" 'multiple' => false, // true / false",
" // Placeholder text",
" 'placeholder' => '${3:Select an item}',",
" // Display \"Select All / None\" button?",
" 'select_all_none' => false, // true / false",
" // select2 configuration. See https://select2.org/configuration",
" 'js_options' => array(",
" 'containerCssClass' => 'my-custom-class',",
" ),",
"),"
],
"description": "Metabox Select Advanced"
},
"Metabox Single Image": {
"prefix": "__mb_single_image",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'single_image',",
"),"
],
"description": "Metabox Single Image"
},
"Metabox Slider": {
"prefix": "__mb_slider",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'slider',",
" // Text labels displayed before and after value",
" 'prefix' => '$',",
" 'suffix' => ' USD',",
" // jQuery UI slider options. See here http://api.jqueryui.com/slider/",
" 'js_options' => array(",
" 'min' => 10,",
" 'max' => 255,",
" 'step' => 5,",
" ),",
" 'std' => 150,",
" // 'clone' => true,",
"),"
],
"description": "Metabox Slider"
},
"Metabox Switch": {
"prefix": "__mb_switch",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'switch',",
" // Style: rounded (default) or square",
" 'style' => 'rounded', // rounded / square",
" // On label: can be any HTML",
" 'on_label' => 'Yes',",
" // Off label",
" 'off_label' => 'No',",
"),"
],
"description": "Metabox Switch"
},
"Metabox Taxonomy": {
"prefix": "__mb_taxonomy",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'taxonomy',",
"",
" // Taxonomy slug.",
" 'taxonomy' => '${3:category}',",
"",
" // How to show taxonomy.",
" 'field_type' => 'select_advanced', // select / select_advanced / select_tree / checkbox_list / checkbox_tree / radio_list",
"),"
],
"description": "Metabox Taxonomy"
},
"Metabox Taxonomy Advanced": {
"prefix": "__mb_taxonomy_advanced",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'taxonomy_advanced',",
" // Taxonomy slug.",
" 'taxonomy' => '${3:category}',",
" // How to show taxonomy.",
" 'field_type' => 'select_advanced', // select / select_advanced / select_tree / checkbox_list / checkbox_tree / radio_list",
"),"
],
"description": "Metabox Taxonomy Advanced"
},
"Metabox Text": {
"prefix": "__mb_text",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'label_description' => '${2:Label Description}',",
" 'id' => '${3:field_name}',",
" 'desc' => '${4:Description}',",
" 'type' => 'text',",
" // Default value (optional)",
" // 'std' => '${5}',",
" // Cloneable (i.e. have multiple value)?",
" 'clone' => ${6:false},",
" // Placeholder",
" 'placeholder' => '${7:Enter something here}',",
" // Input size",
" 'size' => 30,",
"// // Datalist",
"// 'datalist' => array(",
"// // Unique ID for datalist. Optional.",
"// 'id' => 'text_datalist',",
"// // List of predefined options",
"// 'options' => array(",
"// 'What',",
"// 'When',",
"// 'Where',",
"// 'Why',",
"// 'Who',",
"// ),",
"// ),",
"),"
],
"description": "Metabox Text"
},
"Metabox Text List": {
"prefix": "__mb_text_list",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'text_list',",
" 'clone' => true,",
" // Options: array of Placeholder => Label for text boxes",
" // Number of options are not limited",
" 'options' => array(",
" 'John Smith' => 'Name',",
" 'name@domain.com' => 'Email',",
" ),",
"),"
],
"description": "Metabox Text List"
},
"Metabox Textarea": {
"prefix": "__mb_textarea",
"body": [
"array (",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'textarea',",
" 'placeholder' => '',",
" // 'cols' => 60,",
" // 'rows' => 4,",
"),"
],
"description": "Metabox Textarea"
},
"Metabox Time": {
"prefix": "__mb_time",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'time',",
" // Time options, see here http://trentrichardson.com/examples/timepicker/",
" 'js_options' => array(",
" 'stepMinute' => 15,",
" 'controlType' => 'select',",
" 'showButtonPanel' => false,",
" 'oneLine' => true,",
" ),",
" // Display inline?",
" 'inline' => false,",
"),"
],
"description": "Metabox Time"
},
"Metabox User": {
"prefix": "__mb_user",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'user',",
" // Field type.",
" 'field_type' => 'select_advanced',",
" // Placeholder.",
" 'placeholder' => '${3:Select a user}',",
" // Query arguments (optional). No settings means get all published users.",
" // @see https://codex.wordpress.org/Function_Reference/get_users",
" 'query_args' => array(),",
" // 'clone' => true,",
"),"
],
"description": "Metabox User"
},
"Metabox Video": {
"prefix": "__mb_video",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'video',",
" // Maximum video uploads. 0 = unlimited.",
" 'max_file_uploads' => 3,",
" // Delete videos from Media Library when remove it from post meta?",
" // Note: it might affect other posts if you use same videos for multiple posts",
" 'force_delete' => false,",
" // Display the \"Uploaded 1/3 videos\" status",
" 'max_status' => true,",
" // 'clone' => true,",
"),"
],
"description": "Metabox Video"
},
"Metabox WYSIWYG": {
"prefix": "__mb_wysiwyg",
"body": [
"array(",
" 'name' => '${1:Field Label}',",
" 'id' => '${2:field_name}',",
" 'type' => 'wysiwyg',",
" // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save",
" 'raw' => false,",
" // Editor settings, see https://codex.wordpress.org/Function_Reference/wp_editor",
" 'options' => array(",
" 'textarea_rows' => 4,",
" 'teeny' => true,",
" ),",
"),"
],
"description": "Metabox WYSIWYG"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment