У меня проблема с переносом мета-блоков в пользовательские типы записей, которые создаются с помощью плагина.
Я прошел через код сто раз и начинаю задумываться, не оказывает ли влияние Класс,array($this, 'insT_tag')
работает как ссылка для обратного вызова?
Я действительно не вижу, что может быть не так!У меня есть пример кода, который я использую для создания типа, а затем добавить мета-поле.У кого-нибудь есть идеи?
function init_custom_post_types() {
register_post_type('inGallery', array(
'labels' => array(
'name' => __('inGalleries', 'inGallery'),
'singular_name' => 'inGallery',
'add_new' => 'Add new inGallery',
'add_new_item' => 'Add new inGallery',
'edit_item' => 'Edit inGallery',
'new_item' => 'New inGallery',
'view_item' => 'Show inGallery',
'search_items' => 'Search inGallery',
'not_found' => 'Not found',
'not_found_in_trash' => 'No inGallery was found in trash',
'parent_item_colon' => 'Parent:'
),
'public' => true,
'exclude_from_search' => false,
'query_var' => true,
'capability_type' => 'post',
'show_in_nav_menus' => true,
'menu_position' => 5,
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'revisions'),
'taxonomies' => array('category', 'post_tag'),
'rewrite' => array( 'slug' => 'in', 'with_front' => false ),
'publicly_queryable' => true,
'exclude_from_search' => false,
'can_export' => true,
'register_meta_box_cb' => array($this , 'add_inGallery_metaboxes' )
));
// Add the custom type to the homepage post loop
add_filter( 'pre_get_posts', array($this, 'customTypeToPosts'));
}
public function add_inGallery_metaboxes () {
add_meta_box( 'insT_tag', 'Hash Tag', array($this, 'insT_tag'), 'inGallery', 'side', 'high' , array('tester'));
}
public function insT_tag ( $a ) {
print_r($a);
echo'<input type="text" value="tester"/>';
}