I've generated the following custom metaboxes using the online generator but I'm having trouble making this content "show up" under my desired CPT
function MatchlessProperty( $meta_boxes ) {
$prefix = 'MW';
$meta_boxes[] = array(
'id' => 'mwlistingdetails',
'title' => esc_html__( 'MW Listing Details', 'matchless-property' ),
'post_types' => array( 'post' ),
'context' => 'normal',
'priority' => 'default',
'autosave' => true,
'fields' => array(
array(
'id' => $prefix . 'tagline',
'type' => 'text',
'name' => esc_html__( 'Tagline', 'matchless-property' ),
'placeholder' => esc_html__( 'i.e. Awesome Hunting Land', 'matchless-property' ),
),
array(
'id' => $prefix . 'address',
'type' => 'text',
'name' => esc_html__( 'Address', 'matchless-property' ),
'placeholder' => esc_html__( 'i.e. 101 County Rd.', 'matchless-property' ),
),
array(
'id' => $prefix . 'county',
'name' => esc_html__( 'County', 'matchless-property' ),
'type' => 'select',
'placeholder' => esc_html__( 'Select an Item', 'matchless-property' ),
'options' => array(
'Adams' => 'Adams',
'Alcorn' => 'Alcorn',
'Amite' => 'Amite',
'Attala' => 'Attala',
'Benton' => 'Benton',
'Bolivar' => 'Bolivar',
'Calhoun' => 'Calhoun',
'Chickasaw' => 'Chickasaw',
'Chocktaw' => 'Chocktaw',
'Claiborne' => 'Claiborne',
'Clarke' => 'Clarke',
'Clay' => 'Clay',
'Coahoma' => 'Coahoma',
'Copiah' => 'Copiah',
'Covington' => 'Covington',
'DeSoto' => 'DeC',
'Forrest' => 'Forrest',
'Franklin' => 'Franklin',
'George' => 'George',
'Greene' => 'Greene',
'Grenada' => 'Grenada',
'Hancock' => 'Hancock',
'Harrison' => 'Harrison',
'Hinds' => 'Hinds',
'Holmes' => 'Holn',
'Humphreys' => 'Humphreys',
'Issaquena' => 'Issaquena',
'Itawamba' => 'Itawan',
'Jackson' => 'j',
'Jasper' => 'Jac',
'Jefferson' => 'Jefferson',
'Jefferson Davis' => 'Jefferson',
'Jones' => 'Jones',
'Kemper' => 'Kemper',
'Lafayette' => 'Lafayette',
'Lamar' => 'Lamar',
'Lauderdale' => 'Lauderdale',
'Lawrence' => 'Lawrence',
'Leake' => 'Leake',
'Leflore' => 'Leflore',
'Lincoln' => 'Lincoln',
'Lowndes' => 'Lowndes',
'Madison' => 'Madison',
'Marion' => 'Marion',
'Marshall' => 'Marshall',
'Monroe' => 'Monroe',
'Montgomery' => 'Montgomeru',
'Neshoba' => 'Neshoba',
'Newton' => 'Newton',
'Oktibbeha' => 'Oktibbeha',
'Panola' => 'Panola',
'Pearl River' => 'Pearl',
'Perry' => 'Perry',
'Pike' => 'Pike',
'Pontotoc' => 'Pontotoc',
'Prentiss' => 'Prentiss',
'Quitman' => 'Quitman',
'Rankin' => 'Rankin',
'Scott' => 'Scott',
'Sharkey' => 'Sharkey',
'Simpson' => 'Simpson',
'Smith' => 'Smith',
'Stone' => 'Stone',
'Sunflower' => 'Sunflower',
'Tallahatchie' => 'Tasll',
'Tate' => 'Tate',
'Tippah' => 'Tippah',
'Tishomingo' => 'Tishi',
'Tunica' => 'Tunica',
'Union' => 'Tn',
'Walthall' => 'Walthall',
'Warren' => 'Warren',
'Washington' => 'Washington',
'Wayne' => 'Wayne',
'Webster' => 'Webster',
'Wilkinson' => 'Wilkinson',
'Winston' => 'Winston',
'Yalobusha' => 'Yalobusha',
'Yazoo' => 'Yazoo',
),
'std' => 'Adams',
),
array(
'id' => $prefix . 'price',
'type' => 'text',
'name' => esc_html__( 'Price', 'matchless-property' ),
'placeholder' => esc_html__( 'i.e. $500,000', 'matchless-property' ),
),
array(
'id' => $prefix . 'agent_1',
'type' => 'text',
'name' => esc_html__( 'Agent 1', 'matchless-property' ),
'placeholder' => esc_html__( 'i.e. Cole DeLong', 'matchless-property' ),
),
array(
'id' => $prefix . 'agent_1_phone',
'type' => 'text',
'name' => esc_html__( 'Agent 1 Phone', 'matchless-property' ),
'placeholder' => esc_html__( 'i.e. (601) 555-555', 'matchless-property' ),
),
array(
'id' => $prefix . 'agent_1_photo',
'type' => 'file_input',
'name' => esc_html__( 'Agent 1 Photo', 'matchless-property' ),
),
array(
'id' => $prefix . 'agent_2',
'type' => 'text',
'name' => esc_html__( 'Agent 2', 'matchless-property' ),
'placeholder' => esc_html__( 'i.e. John Doe', 'matchless-property' ),
),
array(
'id' => $prefix . 'agent_2_phone',
'type' => 'text',
'name' => esc_html__( 'Agent 2 Phone', 'matchless-property' ),
'placeholder' => esc_html__( '(601) 555-5555', 'matchless-property' ),
),
array(
'id' => $prefix . 'agent_2_photo',
'type' => 'file_input',
'name' => esc_html__( 'Agent 2 Photo', 'matchless-property' ),
),
array(
'id' => $prefix . 'status',
'name' => esc_html__( 'Status', 'matchless-property' ),
'type' => 'select',
'placeholder' => esc_html__( 'Select an Item', 'matchless-property' ),
'options' => array(
'For Sale' => 'For Sale',
'Pending' => 'Pending',
'Leased' => 'Leased',
'For Lease' => 'For Lease',
),
'std' => 'For Sale',
),
array(
'id' => $prefix . 'google_map_upload',
'type' => 'file_advanced',
'name' => esc_html__( 'Google Map Upload', 'matchless-property' ),
'max_file_uploads' => 1,
'max_status' => true,
),
array(
'id' => $prefix . 'topo_map_upload',
'type' => 'file_advanced',
'name' => esc_html__( 'Topo Map Upload', 'matchless-property' ),
'max_file_uploads' => 1,
'max_status' => true,
),
array(
'id' => $prefix . 'aerial_map_upload',
'type' => 'file_advanced',
'name' => esc_html__( 'Aerial Map Upload', 'matchless-property' ),
'max_file_uploads' => 1,
'max_status' => true,
),
),
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'MatchlessProperty' );
And now I'm trying to have these metaboxes "show up" in my custom post type created using the free Meta Box Custom Post Type plugin.
But I can't seem to make it happen. The metaboxes currently just appear under the standard wordpress posts. It may have to do with an incorrect setup of the custom post type. For reference here's the code for the CPT:
function mwproperty_register_post_type() {
$args = array (
'label' => esc_html__( 'MW Properties', 'mwproperty' ),
'labels' => array(
'menu_name' => esc_html__( 'MW Properties', 'mwproperty' ),
'name_admin_bar' => esc_html__( 'MW Property', 'mwproperty' ),
'add_new' => esc_html__( 'Add new', 'mwproperty' ),
'add_new_item' => esc_html__( 'Add new MW Property', 'mwproperty' ),
'new_item' => esc_html__( 'New MW Property', 'mwproperty' ),
'edit_item' => esc_html__( 'Edit MW Property', 'mwproperty' ),
'view_item' => esc_html__( 'View MW Property', 'mwproperty' ),
'update_item' => esc_html__( 'Update MW Property', 'mwproperty' ),
'all_items' => esc_html__( 'All MW Properties', 'mwproperty' ),
'search_items' => esc_html__( 'Search MW Properties', 'mwproperty' ),
'parent_item_colon' => esc_html__( 'Parent MW Property', 'mwproperty' ),
'not_found' => esc_html__( 'No MW Properties found', 'mwproperty' ),
'not_found_in_trash' => esc_html__( 'No MW Properties found in Trash', 'mwproperty' ),
'name' => esc_html__( 'MW Properties', 'mwproperty' ),
'singular_name' => esc_html__( 'MW Property', 'mwproperty' ),
),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'capability_type' => 'post',
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'supports' => array(
'title',
'editor',
'thumbnail',
'custom-fields',
),
'rewrite' => true,
);
register_post_type( 'mw-property', $args );
}
add_action( 'init', 'mwproperty_register_post_type' );