{"id":1652,"date":"2014-03-16T20:20:17","date_gmt":"2014-03-16T20:20:17","guid":{"rendered":"http:\/\/musilda.cz\/?p=1652"},"modified":"2014-03-16T20:20:17","modified_gmt":"2014-03-16T20:20:17","slug":"jak-zmenit-defaultni-obrazek-produktu-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-zmenit-defaultni-obrazek-produktu-ve-woocommerce\/","title":{"rendered":"Jak zm\u011bnit defaultn\u00ed obr\u00e1zek produktu ve Woocommerce"},"content":{"rendered":"\n
Dne\u0161n\u00ed tip a \u00fapravu Woocommerce, je zm\u011bna defaultn\u00edho obr\u00e1zku, kter\u00fd plugin zobraz\u00ed, pokud u va\u0161eho produktu chyb\u00ed n\u00e1hledov\u00fd obr\u00e1zek. Ten co ve Woocommerce je, se v\u011bt\u0161inou nehod\u00ed ke grafice eshopu.<\/p>\n\n\n\n\n\n\n\n
V podstat\u011b jde o pou\u017eit\u00ed filtru woocommerce_placeholder_img_src, kter\u00fd definuje url image placeholderu. N\u00e1sleduj\u00edc\u00ed funkci vlo\u017e\u00edte do functions.php a uprav\u00edte url k obr\u00e1zku.<\/p>\n\n\n\n
add_action( 'init', 'custom_fix_thumbnail' );\n\nfunction custom_fix_thumbnail() {\n add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');\n\n\tfunction custom_woocommerce_placeholder_img_src( $src ) {\n\t$upload_dir = wp_upload_dir();\n\t$uploads = untrailingslashit( $upload_dir['baseurl'] );\n\t$src = $uploads . '\/2014\/03\/thumb1.jpg';\n\n\treturn $src;\n\t}\n}\n<\/pre>\n\n\n\nNic v\u00edc nen\u00ed pot\u0159eba.
Pokud chcete d\u00e1t u\u017eivateli mo\u017enost definovat image placeholder v administraci, vyu\u017eijte plugin, kter\u00fd jsem na\u0161el na GitHubu – Woocommerce Image placeholder customize<\/a><\/p>\n\n\n\n