{"id":1725,"date":"2014-04-08T19:00:41","date_gmt":"2014-04-08T19:00:41","guid":{"rendered":"http:\/\/musilda.cz\/?p=1725"},"modified":"2014-04-08T19:00:41","modified_gmt":"2014-04-08T19:00:41","slug":"jak-upravit-breadcrumbs-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-upravit-breadcrumbs-ve-woocommerce\/","title":{"rendered":"Jak upravit breadcrumbs ve Woocommerce"},"content":{"rendered":"

Pro zobrazen\u00ed drobe\u010dkov\u00e9 navigace, m\u00e1 Woocommerce vlastn\u00ed funkci, kterou nap\u0159\u00edklad ve v\u00fdpisu produkt\u016f, zav\u011b\u0161uje do akce\u00a0woocommerce_before_main_content. Tak\u017ee pokud pot\u0159ebujete breadcrumbs upravovat, zde najdete n\u011bkolik funkc\u00ed, kter\u00e9 v\u00e1m to usnadn\u00ed.<\/p>\n

V\u0161echny funkce vkl\u00e1dejte do functions.php, nebo do odpov\u00eddaj\u00edc\u00edho souboru, pokud vol\u00e1te hook z pluginu.<\/p>\n

Zm\u011bna textu „Home“ na za\u010d\u00e1tku navigace na „\u00davod“<\/h2>\n
\nadd_filter( 'woocommerce_breadcrumb_defaults', 'jk_change_breadcrumb_home_text' );\nfunction jk_change_breadcrumb_home_text( $defaults ) {\n\t$defaults['home'] = '\u00davod';\n\treturn $defaults;\n}\n<\/pre>\n

Zm\u011bna separatoru v breadcrumbs<\/h2>\n
\nadd_filter( 'woocommerce_breadcrumb_defaults', 'jk_change_breadcrumb_delimiter' );\nfunction jk_change_breadcrumb_delimiter( $defaults ) {\n\t$defaults['delimiter'] = ' > ';\n\treturn $defaults;\n}\n<\/pre>\n

Samoz\u0159ejm\u011b z\u00e1le\u017e\u00ed na v\u00e1s, jak\u00fd znak pou\u017eijete.<\/p>\n

Zm\u011bna odkazu „Home“ na linou url<\/h2>\n
\nadd_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url' );\nfunction woo_custom_breadrumb_home_url() {\n    return 'http:\/\/example.cz';\n}\n<\/pre>\n

Odstran\u011bn\u00ed drobe\u010dkov\u00e9 navigace<\/h2>\n
\nadd_action( 'init', 'jk_remove_wc_breadcrumbs' );\nfunction jk_remove_wc_breadcrumbs() {\n    remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );\n}\n<\/pre>\n

Celkov\u00e1 zm\u011bna drobe\u010dkov\u00e9 navigace<\/h2>\n

Pokud pot\u0159ebujete upravit drobe\u010dkovou navigaci pon\u011bkud v\u00edce, nem\u00e1 smysl pou\u017e\u00edvat jednotliv\u00e9 funkce, ale upravit rovnou cel\u00e9 pole s nastaven\u00edm:<\/p>\n

\nadd_filter( 'woocommerce_breadcrumb_defaults', 'jk_woocommerce_breadcrumbs' );\nfunction jk_woocommerce_breadcrumbs() {\n    return array(\n            'delimiter'   => ' / ',\n            'wrap_before' => '