• На только что установленном WP.
    В функциях темы если ставлю такой код:

    register_sidebar(array(
        	'name' => 'Sidebar Left',
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));
    
    function myreg_post_type() {
    
    $cp_custom_post_types = array('ad', 'org');
    $cp_custom_post_types_cnt=1;
    foreach ( $cp_custom_post_types as $cp_custom_post_type)
    	{
        register_post_type( $cp_custom_post_type.'_listing',
            array( 'labels' => array(
                'name' => $cp_custom_post_type.'s',
                'singular_name' => $cp_custom_post_type
                ),
                'description' => '',
                'public' => true,
                'show_ui' => true,
                'capability_type' => 'post',
                'publicly_queryable' => true,
                'exclude_from_search' => false,
                'menu_position' => 8,
                'menu_icon' => FAVICON,
                'hierarchical' => false,
                'rewrite' => array(
                	'slug' => $cp_custom_post_type.'s',
                	'with_front' => false
                	),
                'query_var' => true,
                'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky' ),
                )
    );
    
        register_taxonomy( $cp_custom_post_type.'_cat',
                array($cp_custom_post_type.'_listing'),
                array('hierarchical' => true,
                      'labels' => array(
                            'name' => $cp_custom_post_type.' Categories',
                            'singular_name' => $cp_custom_post_type.' Category'
                        ),
                        'show_ui' => true,
                        'query_var' => true,
    					'update_count_callback' => '_update_post_term_count',
                        //'rewrite' => array(
                        	//'slug' => $cp_custom_post_type.'-category',
                        	//'with_front' => false,
                        //	'hierarchical' => true ),
                )
        );
    
            register_taxonomy( $cp_custom_post_type.'_tag',
                array($cp_custom_post_type.'_listing'),
                array('hierarchical' => false,
                      'labels' => array(
                            'name' => $cp_custom_post_type.' Tags',
                            'singular_name' => $cp_custom_post_type.' Tag'
                        ),
                        'show_ui' => true,
                        'query_var' => true,
    					'update_count_callback' => '_update_post_term_count',
                        //'rewrite' => array(
                        	//'slug' => $cp_custom_post_type.'-tag',
                        	//'with_front' => false
                        //	),
                	)
        		);
        $cp_custom_post_types_cnt++;
        }
    }
    
    add_action( 'init', 'myreg_post_type', 0 );

    Появляются кастомные типы постов в админке, таксономии к ним…
    Но! В Дизайне меню — ничего не появляется.
    Если меняю соотв. строки на:

    $cp_custom_post_type.'_cats'
    $cp_custom_post_type.'_tags'

    или

    $cp_custom_post_type.'_catw'
    $cp_custom_post_type.'_tagw'

    — то все сразу появляется.

    Зарезервированные окончания для таксономий? Где найти в кодексе?
    Не ради любопытства — есть библиотека, в которой править все никак не охота — большая.

Просмотр 4 ответов — с 1 по 4 (всего 4)
  • Уточняю:

    Эксперимент.
    1. Скачиваем WP последний русский
    2. В теме по умолчанию twentyten в functions.php ставим код, для чистоты эксперимента отсюда:

    Код такой:

    //create two taxonomies, genres and writers for the post type "book"
    function create_book_taxonomies()
    {
      // Add new taxonomy, make it hierarchical (like categories)
      $labels = array(
        'name' => _x( 'Genres', 'taxonomy general name' ),
        'singular_name' => _x( 'Genre', 'taxonomy singular name' ),

    register_taxonomy('writer','book',array(
        'hierarchical' => false,
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'writer' ),
      ));
    }

    3. Производим установку.
    4. Лезем в Внешний вид -> Меню
    … Нету там новых writer и genre
    5. Меняем register_taxonomy(‘writer’ на register_taxonomy(‘writer2’
    6. Жмем F5 в браузере
    … Все появилось.
    Т.е. если в моей теме в functions.php подобные конструкции — то при подключении темы к новому WP — глюк.
    Как бороться?

    Поаккуратнее надо с тегами (я про html, а не про таксономию) 😉

    Сорри 🙂
    Отредактировал-бы 1-й пост, но не вижу как…

    Ах, да, еще и первый. Ща мы его…

Просмотр 4 ответов — с 1 по 4 (всего 4)
  • Тема «register_taxonomy с окончаниями _tag и _cat» закрыта для новых ответов.