Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * CPT Metaboxes
- *
- * This file registers any custom metaboxes
- *
- *
- * @package All Themes Core Functionality Plugin
- * @since 1.0.0
- * @author Marj Wyatt aka Virtually Marj <marj@virtuallymarj.com>
- * @copyright Copyright (c) 2013, Virtually Marj
- * @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
- * @link https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress
- */
- /**
- * Create Metaboxes
- */
- function vm_metaboxes( $meta_boxes ) {
- // Start with an underscore to hide fields from custom fields list
- $prefix = '_vm_';
- $meta_boxes[] = array(
- 'id' => 'page-options',
- 'title' => 'Page Options',
- 'pages' => array('page'),
- 'context' => 'normal',
- 'priority' => 'high',
- 'show_names' => true,
- 'fields' => array(
- array(
- 'name' => 'Subtitle',
- 'desc' => '',
- 'id' => 'vm_page_subtitle2',
- 'type' => 'text'
- ),
- ),
- );
- $meta_boxes[] = array(
- 'id' => 'portfolio-details',
- 'title' => 'Project Details Box',
- 'pages' => array( 'post'), // Post type
- 'context' => 'normal',
- 'priority' => 'high',
- 'show_names' => true, // Show field names on the left
- 'fields' => array(
- array(
- 'name' => 'MP3 File',
- 'desc' => 'Upload your Audio File',
- 'id' => $prefix . 'postMP3',
- 'type' => 'file',
- ),
- array(
- 'name' => 'Project Thumbnail',
- 'desc' => 'Upload an image to go along with your song',
- 'id' => $prefix . 'postThumb',
- 'type' => 'file',
- ),
- ),
- );
- $meta_boxes[] = array(
- 'id' => 'post-optin',
- 'title' => 'Post Optin Widget',
- 'pages' => array( 'post', 'page'), // Post type
- 'context' => 'normal',
- 'priority' => 'high',
- 'show_names' => true, // Show field names on the left
- 'fields' => array(
- array(
- 'name' => 'Optin Code',
- 'desc' => 'Enter script or HTML for your Form',
- 'id' => $prefix . 'postOptin',
- 'type' => 'textarea_code',
- ),
- ),
- );
- $meta_boxes[] = array(
- 'id' => 'project-details',
- 'title' => 'Project Details Box',
- 'pages' => array( 'portfolio'), // Post type
- 'context' => 'normal',
- 'priority' => 'high',
- 'show_names' => true, // Show field names on the left
- 'fields' => array(
- array(
- 'name' => 'Genre Select',
- 'desc' => 'Choose One Category',
- 'id' => $prefix . 'projectTaxonomy',
- 'type' => 'taxonomy_select',
- 'taxonomy' => 'website-type', // Taxonomy Slug
- ),
- array(
- 'name' => 'MP3 File',
- 'desc' => 'Upload your Audio File',
- 'id' => $prefix . 'projectMP3',
- 'type' => 'file',
- ),
- array(
- 'name' => 'Project Thumbnail',
- 'desc' => 'Upload an image to go along with your song',
- 'id' => $prefix . 'projectThumb',
- 'type' => 'file',
- ),
- array(
- 'name' => 'Other Contributors',
- 'desc' => 'List backup vocalists and/or band members',
- 'id' => $prefix . 'projectContributors',
- 'type' => 'wysiwyg',
- 'options' => array(
- 'textarea_rows' => 5,
- 'wpautop' => true, // use wpautop?
- 'teeny' => true, // output the minimal editor config used in Press This
- 'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
- 'media_buttons' => false, ),
- ),
- array(
- 'name' => 'Artist Name',
- 'desc' => 'Name of Primary Artist',
- 'id' => $prefix . 'projectArtist',
- 'type' => 'text',
- ),
- array(
- 'name' => 'Album Name',
- 'desc' => 'Enter name of Album if any',
- 'id' => $prefix . 'projectAlbum',
- 'type' => 'text',
- ),
- array(
- 'name' => 'Test Text Small',
- 'desc' => 'field description (optional)',
- 'id' => $prefix . 'projectTextSmall',
- 'type' => 'text_small',
- ),
- array(
- 'name' => 'oEmbed',
- 'desc' => 'Enter a youtube, twitter, or instagram URL. Supports services listed at <a href="http://codex.wordpress.org/Embeds">http://codex.wordpress.org/Embeds</a>.',
- 'id' => $prefix . 'projectEmbed',
- 'type' => 'oembed',
- ),
- ),
- );
- return $meta_boxes;
- }
- //add_filter( 'cmb2_meta_boxes' , 'vm_metaboxes' );
- add_action( 'cmb2_admin_init', 'vm_metaboxes' );
- /**
- * Initialize Metabox Class
- * @since 1.0.0
- * see /lib/metabox/example-functions.php for more information
- *
- */
- function vm_initialize_cmb2_meta_boxes() {
- /*if ( !class_exists( 'cmb_Meta_Box' ) ) {
- require_once( VM_DIR . '/lib/cmb2-metabox/init.php' );
- }*/
- if ( file_exists( __DIR__ . '/cmb2-metabox/init.php' ) ) {
- require_once __DIR__ . '/cmb2-metabox/init.php';
- } elseif ( file_exists( __DIR__ . '/CMB2/init.php' ) ) {
- require_once __DIR__ . '/CMB2/init.php';
- }
- }
- add_action( 'init', 'vm_initialize_cmb2_meta_boxes', 9999 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement