Skip to content

Instantly share code, notes, and snippets.

<?php
function add_custom_meta_box(){
add_meta_box("test-meta-box", "Custom Meta Box", "custom_meta_box_markup", "post", "side", "high", null);
}
add_action("add_meta_boxes", "add_custom_meta_box");
function custom_meta_box_markup($object){
wp_nonce_field(basename(__FILE__), "meta-box-nonce");
?>
@anik
anik / Metabox
Last active August 29, 2015 14:22
Metabox.io Shorthand List
*********************************************************************************
**
**
*********************************************************************************
// TEXT
array(
// Field name - Will be used as label
'name' => __( 'Text', 'your-prefix' ),
// Field ID, i.e. the meta key
'id' => "{$prefix}text",
<?php
$countries = array();
$countries[] = array("iso_code"=>"AF","country_name"=>"Afghanistan","country_code"=>"93");
$countries[] = array("iso_code"=>"AL","country_name"=>"Albania","country_code"=>"355");
$countries[] = array("iso_code"=>"DZ","country_name"=>"Algeria","country_code"=>"213");
$countries[] = array("iso_code"=>"AS","country_name"=>"American Samoa","country_code"=>"1");
$countries[] = array("iso_code"=>"AD","country_name"=>"Andorra","country_code"=>"376");
$countries[] = array("iso_code"=>"AO","country_name"=>"Angola","country_code"=>"244");
$countries[] = array("iso_code"=>"AI","country_name"=>"Anguilla","country_code"=>"1");
$countries[] = array("iso_code"=>"AG","country_name"=>"Antigua","country_code"=>"1");
@anik
anik / Visual Composer Shortcode
Last active August 2, 2016 11:20
Visual Composer Shortcode
*********************************************************************************
*********************************************************************************
// Checkbox
// Color Picker
// Number
// Dropdown
// Textfield
// Attach Image
// Textarea HTML
// Add Link