{"id":6375,"date":"2021-10-18T08:28:00","date_gmt":"2021-10-18T08:28:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=6375"},"modified":"2021-10-18T08:28:00","modified_gmt":"2021-10-18T08:28:00","slug":"deaktivace-vypisu-kategorii-produktu-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/deaktivace-vypisu-kategorii-produktu-ve-woocommerce\/","title":{"rendered":"Deaktivace v\u00fdpisu kategori\u00ed produkt\u016f ve WooCommerce"},"content":{"rendered":"\n

WooCommerce je super na men\u0161\u00ed e-shopy. V kombinaci s WordPressem si m\u016f\u017eete vytvo\u0159it str\u00e1nky, kter\u00e9 jako e-shop v\u016fbec nevypadaj\u00ed. <\/p>\n\n\n\n

Typick\u00fdm p\u0159\u00edkladem jsou jedno produktov\u00e9 e-shopy.<\/p>\n\n\n\n

U nich, nebo u e-shop\u016f, kter\u00e9 maj\u00ed jednotky produkt\u016f, co\u017e b\u00fdvaj\u00ed dost \u010dasto r\u016fzn\u00e9 e-booky a podobn\u011b, jsou prodejn\u00ed str\u00e1nkou landing page. <\/p>\n\n\n\n

V Elementoru, \u010di jin\u00e9m builderu si naklik\u00e1te design, do n\u011bj p\u0159id\u00e1te tla\u010d\u00edtko s odkazem na p\u0159id\u00e1n\u00ed do ko\u0161\u00edku a m\u00e1te v podstat\u011b hotovo. Z\u00e1kazn\u00edk je p\u0159esm\u011brov\u00e1n na pokladnu a v\u0161e je super. <\/p>\n\n\n\n

A co na to Google?<\/h2>\n\n\n\n

Nejd\u0159\u00edv tro\u0161ku odbo\u010dka ke custom post type ve WordPressu. <\/p>\n\n\n\n

Kdy\u017e definujete custom post type, tak \u0159\u00edk\u00e1te, zda ten custom post type (v na\u0161em p\u0159\u00edpad\u011b product), bude m\u00edt arch\u00edvy. Pro e-shop to jsou \u0161t\u00edtky produkt\u016f a kategorie produkt\u016f. <\/p>\n\n\n\n

A ka\u017ed\u00fd e-shop na WooCommerce m\u00e1 ob\u011b tyto taxonomie a jejich arch\u00edvy definovan\u00e9. Nav\u00edc, ka\u017ed\u00fd produkt mus\u00ed m\u00edt n\u011bjakou kategorii. Proto je hned po instalaci ka\u017ed\u00fd produkt za\u0159azen\u00fd do kategorie „Neza\u0159azen\u00e9“. <\/p>\n\n\n\n

Co\u017e znamen\u00e1, \u017ee i kdy\u017e m\u00e1te jedno produktov\u00fd e-shop, stejn\u011b na n\u011bm m\u00e1te dostupnou url https:\/\/eshop.cz\/kategorie-produktu\/nezarazene\/. <\/p>\n\n\n\n

Nav\u00edc, pokud nainstalujete n\u011bjak\u00fd seo plugin, tak ten automaticky vytvo\u0159\u00ed xml sitemapu pro kategorie produkt\u016f. A Google tu url zaindexuje a bude ji zobrazovat ve v\u00fdsledku vyhled\u00e1v\u00e1n\u00ed. <\/p>\n\n\n\n

Co\u017e nechceme. <\/p>\n\n\n\n

Bohu\u017eel toto \u0159ada web\u016f nem\u00e1 o\u0161et\u0159en\u00e9. Na obr\u00e1zku vid\u00edte v\u00fdpis kategorie neza\u0159azen\u00e9 u str\u00e1nky s jedn\u00edm produktem:<\/p>\n\n\n\n

\"\"<\/a><\/figure>\n\n\n\n

Na\u0161t\u011bst\u00ed m\u00e1 WooCommerce filtry na v\u0161echno<\/h2>\n\n\n\n

Nakonec jsme se dostali a\u017e k snippetu, kter\u00fd n\u00e1m vypne arch\u00edvy kategori\u00ed na e-shopu. <\/p>\n\n\n\n

add_filter( 'woocommerce_taxonomy_args_product_cat', 'musilda_disable_product_category', 10, 1 );\nfunction musilda_disable_product_category( $array ) {\n\n\t$array['public'] = false;\n\n\treturn $array;\n\n}\n<\/code><\/pre>\n\n\n\n

Kdy\u017e WooComerce registruje faxonomii product_cat, pole argument\u016f jde skrze filtr woocommerce_taxonomy_args_product_cat a vy tak m\u016f\u017eete WordPressu \u0159\u00edc, \u017ee kategorie produkt\u016f nebude m\u00edt na frontendu viditeln\u00fd archiv. <\/p>\n\n\n\n

Nezapome\u0148te j\u00edt do Nastaven\u00ed -> Trval\u00e9 odkazy a p\u0159eulo\u017eit, aby se zm\u011bna projevila.<\/p>\n","protected":false},"excerpt":{"rendered":"

WooCommerce je super na men\u0161\u00ed e-shopy. V kombinaci s WordPressem si m\u016f\u017eete vytvo\u0159it str\u00e1nky, kter\u00e9 jako e-shop v\u016fbec nevypadaj\u00ed. Typick\u00fdm p\u0159\u00edkladem jsou jedno produktov\u00e9 e-shopy. U nich, nebo u e-shop\u016f, kter\u00e9 maj\u00ed jednotky produkt\u016f, co\u017e b\u00fdvaj\u00ed dost \u010dasto r\u016fzn\u00e9 e-booky a podobn\u011b, jsou prodejn\u00ed str\u00e1nkou landing page. V Elementoru, \u010di jin\u00e9m builderu si naklik\u00e1te design,<\/p>\n","protected":false},"author":1,"featured_media":5600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[29],"tags":[],"class_list":["post-6375","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce-snippety"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6375"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=6375"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6375\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/5600"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=6375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=6375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=6375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}