{"id":5860,"date":"2021-03-12T20:55:10","date_gmt":"2021-03-12T20:55:10","guid":{"rendered":"https:\/\/musilda.cz\/?p=5860"},"modified":"2021-03-12T20:55:10","modified_gmt":"2021-03-12T20:55:10","slug":"jak-pridat-vyrobce-do-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-pridat-vyrobce-do-woocommerce\/","title":{"rendered":"Jak p\u0159idat v\u00fdrobce do WooCommerce"},"content":{"rendered":"\n
V\u00fdrobce, nebo zna\u010dka, je b\u011b\u017en\u00e1 sou\u010d\u00e1st dat produktu v e-shopu. Proto\u017ee WooCommerce v z\u00e1kladu nic takov\u00e9ho neobsahuje, uk\u00e1\u017eeme si, jak do e-shopu zna\u010dku p\u0159idat.<\/p>\n\n\n\n
V podstat\u011b m\u00e1te dv\u011b mo\u017enosti. Bu\u010f pou\u017eijete funkci, kterou si nap\u00ed\u0161ete, nebo si nainstalujete plugin. <\/p>\n\n\n\n
T\u00e9m\u011b\u0159 ve v\u0161ech p\u0159\u00edpadech, kdy jsem se s t\u00edm setkal, \u0161lo o taxonomii produktu. Jin\u00e9 \u0159e\u0161en\u00ed nem\u00e1 ani smysl, proto\u017ee kdy\u017e pou\u017eijete taxonomii, m\u00e1te automaticky k dispozici v\u00fdpis produkt\u016f podle zna\u010dky a nemus\u00edte nic upravovat a nastavovat. <\/p>\n\n\n\n
Z\u00e1rove\u0148 je jednoduch\u00e9 p\u0159idat taxonomii pomoc\u00ed widgetu do sidebaru, nebo jako dal\u0161\u00ed mo\u017enost do filtru produkt\u016f. <\/p>\n\n\n\n
Taxonomie u produktu je to sam\u00e9, jako kategorie, nebo \u0161t\u00edtek u p\u0159\u00edsp\u011bvku. WooCommerce tak\u00e9 obsahuje kategorie produkt, \u0161t\u00edtky produktu a vlastnosti produktu. Tak\u017ee se d\u00e1 zjednodu\u0161en\u011b \u0159\u00edci, \u017ee taxonomie je takov\u00e1 „dal\u0161\u00ed“ kategorie, jen se bude jmenovat zna\u010dka. <\/p>\n\n\n\n
Ka\u017ed\u00fd produkt tak m\u016f\u017ee m\u00edt p\u0159i\u0159azenou n\u011bjakou zna\u010dku. <\/p>\n\n\n\n
Ve WordPressu si m\u016f\u017eete pro druhy obsahu, p\u0159id\u00e1vat vlastn\u00ed taxonomie. slou\u017e\u00ed pro to funkce register_taxonomy, kde si nadefinujete jej\u00ed vlastnosti a p\u0159i\u0159ad\u00edte ji obsahu. V p\u0159\u00edpad\u011b e-shopu to bude post type product. <\/p>\n\n\n\n
N\u00e1sleduj\u00edc\u00ed k\u00f3d sta\u010d\u00ed p\u0159idat do functions.php v aktivn\u00ed \u0161ablon\u011b a budete m\u00edt v e-shopu u produkt\u016f novou taxonomii, nazvanou Zna\u010dka.<\/p>\n\n\n\n
\/\/ Register Custom Taxonomy\nfunction custom_taxonomy() {\n\n\t$labels = array(\n\t\t'name' => _x( 'Zna\u010dky', 'Taxonomy General Name', 'text_domain' ),\n\t\t'singular_name' => _x( 'Zna\u010dka', 'Taxonomy Singular Name', 'text_domain' ),\n\t\t'menu_name' => __( 'Taxonomy', 'text_domain' ),\n\t\t'all_items' => __( 'All Items', 'text_domain' ),\n\t\t'parent_item' => __( 'Parent Item', 'text_domain' ),\n\t\t'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),\n\t\t'new_item_name' => __( 'New Item Name', 'text_domain' ),\n\t\t'add_new_item' => __( 'Add New Item', 'text_domain' ),\n\t\t'edit_item' => __( 'Edit Item', 'text_domain' ),\n\t\t'update_item' => __( 'Update Item', 'text_domain' ),\n\t\t'view_item' => __( 'View Item', 'text_domain' ),\n\t\t'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),\n\t\t'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ),\n\t\t'choose_from_most_used' => __( 'Choose from the most used', 'text_domain' ),\n\t\t'popular_items' => __( 'Popular Items', 'text_domain' ),\n\t\t'search_items' => __( 'Search Items', 'text_domain' ),\n\t\t'not_found' => __( 'Not Found', 'text_domain' ),\n\t\t'no_terms' => __( 'No items', 'text_domain' ),\n\t\t'items_list' => __( 'Items list', 'text_domain' ),\n\t\t'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),\n\t);\n\t$args = array(\n\t\t'labels' => $labels,\n\t\t'hierarchical' => false,\n\t\t'public' => true,\n\t\t'show_ui' => true,\n\t\t'show_admin_column' => true,\n\t\t'show_in_nav_menus' => true,\n\t\t'show_tagcloud' => true,\n\t);\n\tregister_taxonomy( 'znacka', array( 'product' ), $args );\n\n}\nadd_action( 'init', 'custom_taxonomy', 0 );<\/code><\/pre>\n\n\n\nZna\u010dka pomoc\u00ed pluginu<\/h2>\n\n\n\n