Skip to content

Instantly share code, notes, and snippets.

@jdcauley
Created June 29, 2016 01:36
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 jdcauley/6661b21d968020376aae2063583a3fde to your computer and use it in GitHub Desktop.
Save jdcauley/6661b21d968020376aae2063583a3fde to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: MINC
*/
require_once('lib/CMB2/init.php');
class MINC_Fields {
function __contruct(){
add_action( 'init', array($this, 'add_origin_header') );
add_action( 'cmb2_admin_init', array($this, 'minc_fields') );
}
function add_origin_header(){
header('Access-Control-Allow-Origin: *');
}
public function minc_fields(){
$prefix = '_minc_';
$minc_cmb = new_cmb2_box( array(
'id' => 'minc',
'title' => 'MINC Fields',
'object_types' => array( 'post' ),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
) );
$minc_cmb->add_field( array(
'name' => __( 'Website URL', 'cmb2' ),
'id' => $prefix . 'website',
'type' => 'text_url'
) );
$minc_cmb->add_field( array(
'name' => __( 'Facebook URL', 'cmb2' ),
'id' => $prefix . 'facebook',
'type' => 'text_url'
) ) ;
$minc_cmb->add_field( array(
'name' => __( 'Twitter URL', 'cmb2' ),
'id' => $prefix . 'twitter',
'type' => 'text_url'
) );
$minc_cmb->add_field( array(
'name' => __('Email', 'cmb2' ),
'id' => $prefix . 'email',
'type' => 'text_email'
) );
}
}
new MINC_Fields();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment