{"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\n

Nic 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

Dal\u0161\u00ed u\u017eite\u010dn\u00e9 snippety najdete na str\u00e1nce U\u017eite\u010dn\u00e9 snippety pro WooCommerce<\/a><\/strong> <\/p>\n","protected":false},"excerpt":{"rendered":"

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","protected":false},"author":1,"featured_media":8732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[19,25,29],"tags":[425],"class_list":["post-1652","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-woocommerce","category-woocommerce-snippety","tag-woocommerce"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1652"}],"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=1652"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1652\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8732"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=1652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=1652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=1652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}