2017-07-20 3 views
0

私はWooCommerce製品のカスタム分類法を作成しました。製品が動作しないためのカスタム分類法

function add_hunts_type(){ 
// Car Hunts 
    $cHunt_labels = array(
     'name'    => __('Hunts', 'pixar'), 
     'singular_name'  => __('Hunt', 'pixar'), 
     'search_items'  => __('Search Hunts', 'pixar'), 
     'all_items'   => __('All Hunts', 'pixar'), 
     'parent_item'  => __('Parent Hunt', 'pixar'), 
     'parent_item_colon' => __('Parent Hunt:', 'pixar'), 
     'edit_item'   => __('Edit Hunt', 'pixar'), 
     'update_item'  => __('Update Hunt', 'pixar'), 
     'add_new_item'  => __('Add New Hunt', 'pixar'), 
     'new_item_name'  => __('New Hunt', 'pixar'), 
     'menu_name'   => __('Hunts', 'pixar'), 
    ); 
    $cHunt_args = array(
    'labels' => $cHunt_labels, 
    'hierarchical'    => true, 
    'public'      => true, 
    'show_ui'     => true, 
    'show_admin_column'   => true, 
    'show_in_nav_menus'   => true, 
    'show_tagcloud'    => true, 
    'query_var' => true, 
    'rewrite' => array('slug' => 'carhunt') 
    ); 
    register_taxonomy('car_Hunt', 'product', $cHunt_args); 
} 
add_action('init', 'add_hunts_type', 0); 

    /* Flush rewrite rules for custom post types. */ 
add_action('after_switch_theme', 'flush_rewrite_rules'); 

これは管理者にログインすると機能します。私はフロントエンドから試してみたいときにはうまくいきません。

  • 私は、変更パーマリンク
  • を持っている私は.htaccessを削除し、私は私が何かを見逃している場合は私に知らせてください、適切

作業している他の作り付けのものを持って

  • それを再生しています。 WooCommerce

  • 答えて

    0

    登録するカスタム分類function.php

    に機能下回っ
    <?php 
    // Register Custom Taxonomy 
    function custom_taxonomy_Hunt() { 
    
        $labels = array(
         'name'      => 'Hunts', 
         'singular_name'    => 'Hunt', 
         'menu_name'     => 'Hunt', 
         'all_items'     => 'All Hunts', 
         'parent_item'    => 'Parent Hunt', 
         'parent_item_colon'   => 'Parent Hunt:', 
         'new_item_name'    => 'New Hunt Name', 
         'add_new_item'    => 'Add New Hunt', 
         'edit_item'     => 'Edit Hunt', 
         'update_item'    => 'Update Hunt', 
         'separate_items_with_commas' => 'Separate Hunt with commas', 
         'search_items'    => 'Search Hunts', 
         'add_or_remove_items'  => 'Add or remove Hunts', 
         'choose_from_most_used'  => 'Choose from the most used Hunts', 
        ); 
        $args = array(
         'labels'      => $labels, 
         'hierarchical'    => true, 
         'public'      => true, 
         'show_ui'     => true, 
         'show_admin_column'   => true, 
         'show_in_nav_menus'   => true, 
         'show_tagcloud'    => true, 
         'query_var'     => true, 
         'rewrite'     => array('slug' => 'carhunt') 
        ); 
        register_taxonomy('carhunt', 'product', $args); 
        register_taxonomy_for_object_type('carhunt', 'product'); 
    
    } 
    add_action('init', 'custom_taxonomy_Hunt'); 
    ?> 
    
    +0

    を追加help.Thisが仕事をありがとう、私はslugnameにダッシュを置くことを忘れて( - )。グッドそれを維持するだろうここで学ぶべきことがたくさんある。 –

    +0

    あなたは歓迎です:) –

    関連する問題