{"id":6456,"date":"2021-11-07T08:13:00","date_gmt":"2021-11-07T08:13:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=6456"},"modified":"2021-11-07T08:13:00","modified_gmt":"2021-11-07T08:13:00","slug":"jak-zmenit-pocet-produktu-na-strance-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-zmenit-pocet-produktu-na-strance-ve-woocommerce\/","title":{"rendered":"Jak zm\u011bnit po\u010det produkt\u016f na str\u00e1nce ve WooCommerce"},"content":{"rendered":"\n

Zm\u011bna po\u010dtu produkt\u016f na str\u00e1nku v\u00fdpisu ve WooCommerce, pomoc\u00ed jednoduch\u00e9ho snippetu.<\/p>\n\n\n\n

Po\u010det produkt\u016f ve v\u00fdpisu produkt\u016f se d\u00e1 zm\u011bnit pomoc\u00ed nastaven\u00ed ve menu Nastaven\u00ed > Zobrazov\u00e1n\u00ed, ale to ovlivn\u00ed cel\u00fd WordPress, v\u010detn\u011b v\u00fdpisu blogu. <\/p>\n\n\n\n

WooCommerce m\u00e1 filter loop_shop_per_page, kter\u00e1 obsahuje hodnotu po\u010dtu produkt\u016f, p\u0159evzatou pr\u00e1v\u011b z v\u00fd\u0161e uveden\u00e9ho nastaven\u00ed. <\/p>\n\n\n\n

N\u00e1sleduj\u00edc\u00ed snippet v\u00e1m nastav\u00ed zobrazen\u00ed v\u0161ech produkt\u016f na jedn\u00e9 str\u00e1nce:<\/p>\n\n\n\n

add_filter( 'loop_shop_per_page', 'musilda_loop_shop_per_page', 20 );\nfunction musilda_loop_shop_per_page( $cols ) {\n\n\t$cols = -1;\n\n\treturn $cols;\n\n}<\/code><\/pre>\n\n\n\n

Ve funkci m\u016f\u017eete pou\u017e\u00edt jak\u00e9koliv kladn\u00e9 \u010d\u00edslo, ale kdy\u017e pou\u017eijete -1, tak WP_Query dostane informaci, \u017ee m\u00e1 vypsat v\u0161echny v\u00fdsledky. <\/p>\n\n\n\n

S pou\u017eit\u00edm ale opatrn\u011b, vid\u011bl jsem ji\u017e t\u00edmto zp\u016fsobem z\u00edsk\u00e1vat po\u010det v\u0161ech produkt\u016f a to zbyte\u010dn\u011b zpomaluje v\u00fdkon webu. Na z\u00edsk\u00e1n\u00ed po\u010dtu v\u0161ech produkt\u016f se pou\u017e\u00edv\u00e1 n\u011bco \u00fapln\u011b jin\u00e9ho.<\/p>\n","protected":false},"excerpt":{"rendered":"

Zm\u011bna po\u010dtu produkt\u016f na str\u00e1nku v\u00fdpisu ve WooCommerce, pomoc\u00ed jednoduch\u00e9ho snippetu. Po\u010det produkt\u016f ve v\u00fdpisu produkt\u016f se d\u00e1 zm\u011bnit pomoc\u00ed nastaven\u00ed ve menu Nastaven\u00ed > Zobrazov\u00e1n\u00ed, ale to ovlivn\u00ed cel\u00fd WordPress, v\u010detn\u011b v\u00fdpisu blogu. WooCommerce m\u00e1 filter loop_shop_per_page, kter\u00e1 obsahuje hodnotu po\u010dtu produkt\u016f, p\u0159evzatou pr\u00e1v\u011b z v\u00fd\u0161e uveden\u00e9ho nastaven\u00ed. N\u00e1sleduj\u00edc\u00ed snippet v\u00e1m nastav\u00ed zobrazen\u00ed v\u0161ech<\/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-6456","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\/6456"}],"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=6456"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6456\/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=6456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=6456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=6456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}