I am trying to add another field (subtitle) to my already created and existing custom post_type: team (code from functions.php in my *child*theme)
<?php
/**
* Custom Post type register framework
*/
include(get_stylesheet_directory(). '/inc/acpt/init.php');
add_action('init', 'makethem');
function makethem() {
$args = array(
'supports' => array( 'title', 'editor', 'page-attributes', 'thumbnail', 'excerpt' ),
'hierarchical' => true,
);
$team = new post_type('team','team', false, $args );
}
/**
* Initialize the metabox class
*/
add_action( 'init', 'be_initialize_team_meta_boxes', 9999 );
function be_initialize_team_meta_boxes() {
if ( !class_exists( 'team_Meta_Box' ) ) {
require_once( get_stylesheet_directory(). '/inc/metaboxes/fisio-metaboxes.php' );
require_once( get_stylesheet_directory(). '/inc/metaboxes/init.php' );
}
}
?>
And this is the code in fisio-metaboxes.php
<?php
/**
* Include and setup custom metaboxes and fields.
*
* @category YourThemeOrPlugin
* @package Metaboxes
* @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
*/
/**
* Define the metabox and field configurations.
*
* @param array $meta_boxes
* @return array
*/
add_filter( 'team_Meta_Box', 'team_sample_metaboxes' );
function team_sample_metaboxes( array $meta_boxes ) {
$prefix = '_team_';
$meta_boxes[] = array(
'id' => 'team_details',
'title' => 'Team details',
'post_type' => 'team', // Post type
'context' => 'side',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Subtitle',
//'desc' => '',
'id' => $prefix . 'subtitle',
'type' => 'text'
),
),
);
return $meta_boxes;
}
add_action( 'init', 'team_initialize_team_meta_boxes', 9999 );
/**
* Initialize the metabox class.
*/
function team_initialize_team_meta_boxes() {
if ( ! class_exists( 'team_Meta_Box' ) )
require_once get_stylesheet_directory(). '/inc/metaboxes/init.php';
}
The problem is that when in the wp-admin i whant to add a new team's post_type post, the post_type doesn't have the subtitle field
What am I missing?
Edit: In case you Didn't notice I've never done this before. I am following this steps with no succeed..
-EDIT-
I am also trying like this:
$meta_boxes[] = array(
'id' => 'team_details',
'title' => 'Team details',
'pages' => 'team', // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Subtitle',
'desc' => 'This is the subtitle',
'id' => $prefix . 'subtitle',
'type' => 'text'
),
),
);
-EDIT-
Also tried passing the post_type as an array
'pages' => array('team'), // Post type
team_sample_metaboxes
returning to. Where is the team_meta_box filter being used?