Custom Post Type własne kategorie – problem
-
Skonfigurowałem własne kategorie dla własnych typów wpisów. Wszystko działa.
Problem jest w spisie CUSTOM ARTYKUŁÓW nie ma kolumny z kategoriami a użyłem.Obrazowo chodzi o to:
Na liście artykułów brak kolumny kategorii dla custom artykułów
jpg1Kategorie dla custom artykułów odpalam tak:
jpg2Na liście kategorii custom widać wyraźnie że siedzi tam artykuł
jpg3
jpg4Jak zmusić worpdpressa by wyświetlił na liście moich artykułów w CUSTOM POST TYPE kolumnę do której custom kategorii przynależy dany artykuł
Podejrzewam że to jest z tym związane lecz nie funkcjonuje to z moim kodem:
'taxonomies' => array( 'post_tag','artykuly_categories'),
Jeżeli użyje:
'taxonomies' => array( 'post_tag','category'),
Wyświetla się kolumna ale z kategoriami ogólnymi dla zwykłych typów wpisówmoj register sustom post type w functions.php
function artykuly_taxonomy() { register_taxonomy( 'artykuly_kategorie', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces). 'artykuly', //post type name array( 'hierarchical' => true, 'label' => 'artykuly kategorie', //Display name 'query_var' => true, 'rewrite' => array( 'slug' => 'artykuly', // This controls the base slug that will display before each term 'with_front' => false // Don't display the category base before ) ) ); } add_action( 'init', 'artykuly_taxonomy'); function filter_post_type_link($link, $post) { if ($post->post_type != 'artykuly') return $link; if ($cats = get_the_terms($post->ID, 'artykuly_categories')) $link = str_replace('%artykuly_categories%', array_pop($cats)->slug, $link); return $link; } add_filter('post_type_link', 'filter_post_type_link', 10, 2); //Registering Custom Post Type Artykuly add_action( 'init', 'register_artykulypost', 20 ); function register_artykulypost() { $labels = array( 'name' => _x( 'Artykuły', 'my_custom_post','custom' ), 'singular_name' => _x( 'Artykuły', 'my_custom_post', 'custom' ), 'add_new' => _x( 'Add New', 'my_custom_post', 'custom' ), 'add_new_item' => _x( 'Add New ArtykułPost', 'my_custom_post', 'custom' ), 'edit_item' => _x( 'Edit ArtykułPost', 'my_custom_post', 'custom' ), 'new_item' => _x( 'New ArtykułPost', 'my_custom_post', 'custom' ), 'view_item' => _x( 'View ArtykułPost', 'my_custom_post', 'custom' ), 'search_items' => _x( 'Search ArtykułPosts', 'my_custom_post', 'custom' ), 'not_found' => _x( 'No ArtykułPosts found', 'my_custom_post', 'custom' ), 'not_found_in_trash' => _x( 'No ArtykułPosts found in Trash', 'my_custom_post', 'custom' ), 'parent_item_colon' => _x( 'Parent ArtykułPost:', 'my_custom_post', 'custom' ), 'menu_name' => _x( 'Artykuły', 'my_custom_post', 'custom' ), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'description' => 'Custom Artykuły Posts', 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'post-formats', 'custom-fields' ), 'taxonomies' => array( 'post_tag','artykuly_categories'), 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'menu_icon' => get_stylesheet_directory_uri() . '/functions/panel/images/catchinternet-small.png', 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'query_var' => true, 'can_export' => true, 'rewrite' => array('slug' => 'artykuly/%artykuly_categories%','with_front' => FALSE), 'public' => true, 'has_archive' => 'artykuly', 'capability_type' => 'post' ); register_post_type( 'artykuly', $args );//max 20 charachter cannot contain capital letters and spaces }
- Temat ‘Custom Post Type własne kategorie – problem’ jest zamknięty na nowe odpowiedzi.