• Hi everybody, i have to add category taxonomy to my video_podcasts post_type, and it’s okay, taxonomy added, but in admin panel when i’m creating new video_podcasts div where should be my categories is empty and looks like div with tags.
    This is how i added taxonomy:

    register_taxonomy('video_podcasts-category', array('Категории'), array(
    			//'hierarchical' => true,
    			'label' => 'Категории',
    			'query_var' => true,
    			'singular_label' => 'Категории',
    			'rewrite' => true
    		));

    then

    register_post_type( 'video_podcasts', array(
    			'labels'          => $labels,
    			'public'          => true,
    			'show_ui'         => true,
    			'capability_type' => 'post',
    			'menu_icon'       => 'dashicons-video-alt2',
    			'has_archive'     => true,
    			'taxonomies'      => array(
    				'video_podcasts-category'
    			),
    			'hierarchical'    => false,
    			'supports'        => array( 'title', 'thumbnail', 'page-attributes', 'editor' ),
    		) );

    then

    case 'video_podcasts-category':
    				$term = wp_get_post_terms($id, 'video_podcasts-category');
    				$term_type_products = array();
    				foreach ($term as $item) {
    					$term_type_products[] = '<a href="#">' . $item->name . '</a>';
    				}
    				echo implode(',<br>', $term_type_products);
    				break;

    then

    function add_video_podcasts_columns( $columns ) {
    
    		global $pageURLs;
    		$new_columns['cb']              = '<input type="checkbox" />';
    		$new_columns['title']           = _x( 'Заголовок подкаста', 'column name' );
    		$new_columns['played_video_podcasts'] = _x( 'Прослушиваний', 'column name' );
    		$new_columns['date']            = _x( 'Подкаст создан', 'column name' );
    		$new_columns['image_video_podcasts']  = _x( 'Миниатюра', 'column name' );
    		$new_columns['video_podcasts-category'] = _x('Категории', 'column name');
    
    		return $new_columns;
    	}

    why it looks like div for tags?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Category taxonomy’ is closed to new replies.