{"id":304,"date":"2018-03-08T08:41:57","date_gmt":"2018-03-08T07:41:57","guid":{"rendered":"https:\/\/demos.welaunch.io\/woocommerce-pdf-catalog\/?post_type=faq&p=304"},"modified":"2020-07-30T15:00:50","modified_gmt":"2020-07-30T13:00:50","slug":"modify-pdf-category-products-layout","status":"publish","type":"faq","link":"https:\/\/www.welaunch.io\/en\/knowledge-base\/faq\/modify-pdf-category-products-layout\/","title":{"rendered":"Modify PDF category or products layout"},"content":{"rendered":"
If you want to modify the PDF category or products layout for different categories you can use the following 2 filter:<\/p>\n
Example how to modify the category layout:<\/p>\n
function modify_pdf_category_layout( $layout, $category_id) {\n\n\tif($category_id == 18) {\n\t\t$layout = 2;\n\t}\n\n return $layout;\n}\nadd_filter( 'woocommerce_pdf_catalog_category_layout', 'modify_pdf_category_layout', 10, 2 );\n<\/pre>\nExample how to modify the products layout and do not touch the Full catalog layout:<\/p>\n
function modify_pdf_products_layout( $layout, $category_id) {\n\n\t\/\/ Do not modify product layouts for full catalog\n\tif($_GET == \"full\") {\n\t\treturn $layout;\n\t}\n\n\t\/\/ Change the product layout for category 18 (clothing) to Layout 2\n\tif($category_id == 18) {\n\t\t$layout = 1;\n\t}\n\n\t\/\/ Hoodies\n\tif($category_id == 19) {\n\t\t$layout = 2;\n\t}\n\n return $layout;\n}\nadd_filter( 'woocommerce_pdf_catalog_products_layout', 'modify_pdf_products_layout', 10, 2 );\n<\/pre>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","product_cat":[],"class_list":["post-304","faq","type-faq","status-publish","hentry","faq_topics-pdf-catalog-filter-hooks"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=304"}],"version-history":[{"count":1,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/304\/revisions"}],"predecessor-version":[{"id":5594,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/304\/revisions\/5594"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=304"}],"wp:term":[{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/product_cat?post=304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}