generator-chisel 1.0.0 → 2.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +2 -4
  3. package/bin/chisel.js +2 -22
  4. package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -0
  5. package/lib/commands/create/creators/app/chisel-starter-theme/.twig-cs-fixer.php +13 -0
  6. package/lib/commands/create/creators/app/chisel-starter-theme/404.php +16 -0
  7. package/lib/commands/create/creators/app/chisel-starter-theme/README.md +3 -0
  8. package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_666eb7f38d2ed.json +59 -0
  9. package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_66d5a4ebb41cd.json +148 -0
  10. package/lib/commands/create/creators/app/chisel-starter-theme/archive.php +38 -0
  11. package/lib/commands/create/creators/app/chisel-starter-theme/assets/fonts/quicksand-700.woff2 +0 -0
  12. package/lib/commands/create/creators/app/chisel-starter-theme/assets/fonts/quicksand-regular.woff2 +0 -0
  13. package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons/loader.svg +17 -0
  14. package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons/minus.svg +4 -0
  15. package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons/plus.svg +4 -0
  16. package/lib/commands/create/creators/app/chisel-starter-theme/assets/images/chisel.png +0 -0
  17. package/lib/commands/create/creators/app/chisel-starter-theme/author.php +18 -0
  18. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Acf.php +191 -0
  19. package/lib/commands/create/creators/app/chisel-starter-theme/classes/AcfBlocks.php +190 -0
  20. package/lib/commands/create/creators/app/chisel-starter-theme/classes/AcfSync.php +230 -0
  21. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Ajax.php +161 -0
  22. package/lib/commands/create/creators/app/chisel-starter-theme/classes/AjaxEnpoints.php +103 -0
  23. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Assets.php +607 -0
  24. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Blocks.php +270 -0
  25. package/lib/commands/create/creators/app/chisel-starter-theme/classes/ChiselCache.php +87 -0
  26. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Components.php +208 -0
  27. package/lib/commands/create/creators/app/chisel-starter-theme/classes/CustomPostTypes.php +442 -0
  28. package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedImage.php +24 -0
  29. package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedPost.php +42 -0
  30. package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedProduct.php +41 -0
  31. package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedTerm.php +13 -0
  32. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Helpers.php +135 -0
  33. package/lib/commands/create/creators/app/chisel-starter-theme/classes/RegisterBlocks.php +273 -0
  34. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Sidebars.php +110 -0
  35. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Site.php +123 -0
  36. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Theme.php +277 -0
  37. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Twig.php +241 -0
  38. package/lib/commands/create/creators/app/chisel-starter-theme/classes/Woocommerce.php +183 -0
  39. package/lib/commands/create/creators/app/chisel-starter-theme/classes/interfaces/Instance.php +31 -0
  40. package/lib/commands/create/creators/app/chisel-starter-theme/composer.json +18 -0
  41. package/lib/commands/create/creators/app/chisel-starter-theme/composer.lock +2180 -0
  42. package/lib/commands/create/creators/{wp → app}/chisel-starter-theme/footer.php +11 -4
  43. package/lib/commands/create/creators/app/chisel-starter-theme/functions.php +47 -0
  44. package/lib/commands/create/creators/{wp → app}/chisel-starter-theme/header.php +3 -1
  45. package/lib/commands/create/creators/{wp/chisel-starter-theme/index.chisel-tpl.php → app/chisel-starter-theme/index.php} +15 -8
  46. package/lib/commands/create/creators/app/chisel-starter-theme/languages/.gitkeep +0 -0
  47. package/lib/commands/create/creators/app/chisel-starter-theme/lint-staged.config.mjs +8 -0
  48. package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +40 -0
  49. package/lib/commands/create/creators/app/chisel-starter-theme/page.php +25 -0
  50. package/lib/commands/create/creators/app/chisel-starter-theme/patterns/cta.php +39 -0
  51. package/lib/commands/create/creators/app/chisel-starter-theme/phpcs.xml +63 -0
  52. package/lib/commands/create/creators/app/chisel-starter-theme/screenshot.jpg +0 -0
  53. package/lib/commands/create/creators/app/chisel-starter-theme/search.php +15 -0
  54. package/lib/commands/create/creators/app/chisel-starter-theme/single.php +19 -0
  55. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/accordion-item.js +79 -0
  56. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/block.json +36 -0
  57. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/edit.js +80 -0
  58. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/editor.scss +24 -0
  59. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/index.js +44 -0
  60. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/save.js +40 -0
  61. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/style.scss +81 -0
  62. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/view.js +146 -0
  63. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/acf-json/group_66462c70b851f.json +131 -0
  64. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/block.json +28 -0
  65. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/script.js +1 -0
  66. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/slider.twig +26 -0
  67. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/style.scss +5 -0
  68. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/_index.scss +1 -0
  69. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +24 -0
  70. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_breakpoints.scss +70 -0
  71. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_buttons.scss +104 -0
  72. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_icon.scss +5 -0
  73. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_index.scss +9 -0
  74. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_link.scss +15 -0
  75. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_media.scss +6 -0
  76. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_px-to-rem.scss +21 -0
  77. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_screen-readers.scss +30 -0
  78. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_theme.scss +57 -0
  79. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_width.scss +14 -0
  80. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/acf-sync.js +26 -0
  81. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/admin/acf.js +27 -0
  82. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/admin.js +1 -0
  83. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/app.js +7 -0
  84. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/blog.js +0 -0
  85. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-attributes.js +0 -0
  86. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-styles.js +124 -0
  87. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks.js +55 -0
  88. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/components/BlockEditSelector.js +39 -0
  89. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/components/RenderAppender.js +32 -0
  90. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor.js +2 -0
  91. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/login.js +29 -0
  92. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/load-more.js +93 -0
  93. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/main-nav.js +99 -0
  94. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/slider.js +385 -0
  95. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/utils.js +43 -0
  96. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/acf-sync.scss +64 -0
  97. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/admin.scss +1 -0
  98. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss +62 -0
  99. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-details.scss +18 -0
  100. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-gallery.scss +9 -0
  101. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-latest-comments.scss +3 -0
  102. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-latest-posts.scss +82 -0
  103. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-media-text.scss +34 -0
  104. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-post-date.scss +5 -0
  105. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-post-title.scss +7 -0
  106. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-query.scss +65 -0
  107. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-search.scss +15 -0
  108. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-spacer.scss +33 -0
  109. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core.scss +66 -0
  110. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_badge.scss +24 -0
  111. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +67 -0
  112. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_content.scss +42 -0
  113. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_footer.scss +18 -0
  114. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_header.scss +34 -0
  115. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_icon.scss +19 -0
  116. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_load-more.scss +6 -0
  117. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav-toggle.scss +804 -0
  118. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav.scss +305 -0
  119. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_pagination.scss +34 -0
  120. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_post-card.scss +12 -0
  121. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_post.scss +22 -0
  122. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_posts-items.scss +90 -0
  123. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_select2.scss +45 -0
  124. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_sidebar.scss +20 -0
  125. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_slider.scss +122 -0
  126. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/editor.scss +4 -0
  127. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_form.scss +346 -0
  128. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_html.scss +17 -0
  129. package/lib/commands/create/creators/app/{template → chisel-starter-theme}/src/styles/elements/_images.scss +2 -12
  130. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_link.scss +7 -0
  131. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_shared.scss +44 -0
  132. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_table.scss +3 -0
  133. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/generic/_reset.scss +84 -0
  134. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/login.scss +156 -0
  135. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/main.scss +10 -0
  136. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_grid.scss +30 -0
  137. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_layout.scss +62 -0
  138. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_wrapper.scss +18 -0
  139. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/utilities/_sr.scss +9 -0
  140. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/vendor/.gitkeep +0 -0
  141. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/vendor/_gravity-forms.scss +140 -0
  142. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/widgets/_nav-menu.scss +20 -0
  143. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/widgets/_widget.scss +5 -0
  144. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_account.scss +25 -0
  145. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_archive.scss +32 -0
  146. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_btn.scss +49 -0
  147. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_cart.scss +9 -0
  148. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_checkout.scss +53 -0
  149. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_general.scss +68 -0
  150. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_notices.scss +60 -0
  151. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_product-item.scss +29 -0
  152. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_product.scss +24 -0
  153. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woocommerce.scss +3 -0
  154. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_block-edit-selector.scss +47 -0
  155. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_block-sidebar.scss +30 -0
  156. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_core-button.scss +6 -0
  157. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_core-pagination.scss +12 -0
  158. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_core-spacer.scss +14 -0
  159. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_editor.scss +5 -0
  160. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_render-appender.scss +33 -0
  161. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_swiper-sliders.scss +12 -0
  162. package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +12 -0
  163. package/lib/commands/create/creators/app/chisel-starter-theme/theme.json +481 -0
  164. package/lib/commands/create/creators/app/chisel-starter-theme/twig_cs.php +14 -0
  165. package/lib/commands/create/creators/app/chisel-starter-theme/views/404.twig +7 -0
  166. package/lib/commands/create/creators/app/chisel-starter-theme/views/archive.twig +10 -0
  167. package/lib/commands/create/creators/app/chisel-starter-theme/views/author.twig +11 -0
  168. package/lib/commands/create/creators/app/chisel-starter-theme/views/base.twig +43 -0
  169. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/footer.twig +9 -0
  170. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/header.twig +7 -0
  171. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav-item.twig +21 -0
  172. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav.twig +27 -0
  173. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/page-title.twig +5 -0
  174. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/pagination.twig +0 -0
  175. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/post-item.twig +26 -0
  176. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/search-form.twig +0 -0
  177. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/slider.twig +12 -0
  178. package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +36 -0
  179. package/lib/commands/create/creators/app/chisel-starter-theme/views/page-plugin.twig +5 -0
  180. package/lib/commands/create/creators/app/chisel-starter-theme/views/page.twig +6 -0
  181. package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/logo.twig +10 -0
  182. package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/pagination.twig +70 -0
  183. package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/the-title.twig +1 -0
  184. package/lib/commands/create/creators/app/chisel-starter-theme/views/search.twig +10 -0
  185. package/lib/commands/create/creators/app/chisel-starter-theme/views/sidebar-blog.twig +5 -0
  186. package/lib/commands/create/creators/app/chisel-starter-theme/views/sidebar-woocommerce.twig +5 -0
  187. package/lib/commands/create/creators/app/chisel-starter-theme/views/single-password.twig +7 -0
  188. package/lib/commands/create/creators/app/chisel-starter-theme/views/single.twig +56 -0
  189. package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/archive-product.twig +83 -0
  190. package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/content-product.twig +51 -0
  191. package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/linked-products.twig +15 -0
  192. package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/single-product.twig +76 -0
  193. package/lib/commands/create/creators/app/chisel-starter-theme/webpack.config.js +6 -0
  194. package/lib/commands/create/creators/app/chisel-starter-theme/woocommerce.php +57 -0
  195. package/lib/commands/create/creators/app/index.js +28 -75
  196. package/lib/commands/create/creators/app/template/.gitignore.chisel-tpl +2 -2
  197. package/lib/commands/create/creators/init.js +2 -4
  198. package/lib/commands/create/creators/wp/index.js +28 -36
  199. package/lib/commands/create/creators/wp-plugins/index.js +3 -1
  200. package/lib/commands/create/creators/wp-plugins/plugins.json +0 -1
  201. package/lib/commands/create/packages-versions.js +3 -9
  202. package/lib/commands/create/priorities.js +0 -3
  203. package/lib/utils/sort-package.js +3 -9
  204. package/package.json +3 -9
  205. package/lib/commands/create/creators/app/template/.browserslistrc.chisel-tpl +0 -19
  206. package/lib/commands/create/creators/app/template/.editorconfig +0 -17
  207. package/lib/commands/create/creators/app/template/.eslintignore +0 -4
  208. package/lib/commands/create/creators/app/template/.eslintrc.js +0 -25
  209. package/lib/commands/create/creators/app/template/.prettierignore +0 -4
  210. package/lib/commands/create/creators/app/template/.stylelintignore +0 -3
  211. package/lib/commands/create/creators/app/template/babel.config.js +0 -16
  212. package/lib/commands/create/creators/app/template/chisel.config.chisel-tpl.js +0 -48
  213. package/lib/commands/create/creators/app/template/package.chisel-tpl.json +0 -43
  214. package/lib/commands/create/creators/app/template/postcss.config.js +0 -8
  215. package/lib/commands/create/creators/app/template/prettier.config.js +0 -4
  216. package/lib/commands/create/creators/app/template/src/scripts/app.chisel-tpl.js +0 -8
  217. package/lib/commands/create/creators/app/template/src/scripts/modules/greeting.chisel-tpl.js +0 -17
  218. package/lib/commands/create/creators/app/template/src/styles/components/_btn.scss +0 -60
  219. package/lib/commands/create/creators/app/template/src/styles/components/_footer.scss +0 -10
  220. package/lib/commands/create/creators/app/template/src/styles/components/_header.scss +0 -9
  221. package/lib/commands/create/creators/app/template/src/styles/elements/_blockquote.scss +0 -20
  222. package/lib/commands/create/creators/app/template/src/styles/elements/_headings.scss +0 -33
  223. package/lib/commands/create/creators/app/template/src/styles/elements/_html.scss +0 -40
  224. package/lib/commands/create/creators/app/template/src/styles/elements/_links.scss +0 -12
  225. package/lib/commands/create/creators/app/template/src/styles/elements/_lists.scss +0 -23
  226. package/lib/commands/create/creators/app/template/src/styles/elements/_tables.scss +0 -11
  227. package/lib/commands/create/creators/app/template/src/styles/generic/_box-sizing.scss +0 -20
  228. package/lib/commands/create/creators/app/template/src/styles/generic/_font-face.scss +0 -8
  229. package/lib/commands/create/creators/app/template/src/styles/generic/_normalize.scss +0 -5
  230. package/lib/commands/create/creators/app/template/src/styles/generic/_reset.scss +0 -51
  231. package/lib/commands/create/creators/app/template/src/styles/generic/_shared.scss +0 -32
  232. package/lib/commands/create/creators/app/template/src/styles/main.chisel-tpl.scss +0 -13
  233. package/lib/commands/create/creators/app/template/src/styles/objects/_layout.scss +0 -49
  234. package/lib/commands/create/creators/app/template/src/styles/objects/_list-bare.scss +0 -13
  235. package/lib/commands/create/creators/app/template/src/styles/objects/_list-inline.scss +0 -16
  236. package/lib/commands/create/creators/app/template/src/styles/objects/_media.scss +0 -53
  237. package/lib/commands/create/creators/app/template/src/styles/objects/_table.scss +0 -26
  238. package/lib/commands/create/creators/app/template/src/styles/objects/_wrapper.scss +0 -14
  239. package/lib/commands/create/creators/app/template/src/styles/settings/_global.scss +0 -50
  240. package/lib/commands/create/creators/app/template/src/styles/tools/_breakpoints.scss +0 -67
  241. package/lib/commands/create/creators/app/template/src/styles/tools/_clearfix.scss +0 -18
  242. package/lib/commands/create/creators/app/template/src/styles/tools/_hidden.scss +0 -17
  243. package/lib/commands/create/creators/app/template/src/styles/utilities/_align.scss +0 -27
  244. package/lib/commands/create/creators/app/template/src/styles/utilities/_clearfix.scss +0 -11
  245. package/lib/commands/create/creators/app/template/src/styles/utilities/_hide.scss +0 -28
  246. package/lib/commands/create/creators/app/template/src/templates/components/footer.chisel-tpl.twig +0 -3
  247. package/lib/commands/create/creators/app/template/src/templates/components/header.chisel-tpl.twig +0 -3
  248. package/lib/commands/create/creators/app/template/src/templates/layouts/base.chisel-tpl.twig +0 -42
  249. package/lib/commands/create/creators/app/template/src/templates/layouts/page.twig +0 -8
  250. package/lib/commands/create/creators/app/template/stylelint.config.js +0 -3
  251. package/lib/commands/create/creators/fe/index-styles.css +0 -147
  252. package/lib/commands/create/creators/fe/index.js +0 -51
  253. package/lib/commands/create/creators/fe/template/.htmlhintrc +0 -3
  254. package/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html +0 -77
  255. package/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html.rej +0 -13
  256. package/lib/commands/create/creators/wp/chisel-starter-theme/.gitignore.chisel-tpl +0 -1
  257. package/lib/commands/create/creators/wp/chisel-starter-theme/404.chisel-tpl.php +0 -9
  258. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/ChiselExtension.php +0 -14
  259. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/ChiselTwig.php +0 -234
  260. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/DataType.php +0 -27
  261. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/Theme.php +0 -21
  262. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/Twig.php +0 -137
  263. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Helpers.php +0 -29
  264. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Image.php +0 -29
  265. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Media.php +0 -79
  266. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Performance.php +0 -59
  267. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Post.php +0 -82
  268. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Security.php +0 -30
  269. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Settings.php +0 -38
  270. package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Site.php +0 -50
  271. package/lib/commands/create/creators/wp/chisel-starter-theme/README.chisel-tpl.md +0 -5
  272. package/lib/commands/create/creators/wp/chisel-starter-theme/archive.chisel-tpl.php +0 -36
  273. package/lib/commands/create/creators/wp/chisel-starter-theme/author.chisel-tpl.php +0 -16
  274. package/lib/commands/create/creators/wp/chisel-starter-theme/functions.php +0 -31
  275. package/lib/commands/create/creators/wp/chisel-starter-theme/page.chisel-tpl.php +0 -23
  276. package/lib/commands/create/creators/wp/chisel-starter-theme/screenshot.png +0 -0
  277. package/lib/commands/create/creators/wp/chisel-starter-theme/search.chisel-tpl.php +0 -14
  278. package/lib/commands/create/creators/wp/chisel-starter-theme/single.chisel-tpl.php +0 -18
  279. package/lib/commands/create/creators/wp/chisel-starter-theme/style.chisel-tpl.css +0 -5
  280. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/404.twig +0 -5
  281. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/author.twig +0 -7
  282. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/components/comment.twig +0 -7
  283. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/components/main-nav.twig +0 -20
  284. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/components/tease-post.twig +0 -9
  285. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/components/tease.twig +0 -9
  286. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/index.twig +0 -7
  287. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/page-plugin.twig +0 -7
  288. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/page.twig +0 -10
  289. package/lib/commands/create/creators/wp/chisel-starter-theme/templates/single.twig +0 -31
  290. package/lib/commands/create/creators/wp/template/src/styles/components/_comment-form.scss +0 -21
  291. package/lib/commands/create/creators/wp/template/src/styles/components/_comment.scss +0 -17
  292. package/lib/commands/create/creators/wp/template/src/styles/components/_main-nav.scss +0 -54
  293. package/lib/commands/create/creators/wp/template/src/styles/components/_post.scss +0 -36
  294. package/lib/commands/create/creators/wp/template/wp/.gitignore.chisel-tpl +0 -2
  295. package/lib/commands/create/creators/wp/template/wp-cli.yml +0 -1
  296. /package/lib/commands/create/creators/app/{template/src → chisel-starter-theme}/assets/fonts/.keep +0 -0
  297. /package/lib/commands/create/creators/app/{template/src → chisel-starter-theme}/assets/images/.keep +0 -0
  298. /package/lib/commands/create/creators/app/{template/src/styles/vendor/.keep → chisel-starter-theme/classes/Comments.php} +0 -0
  299. /package/lib/commands/create/creators/{fe/template/public/.keep → app/chisel-starter-theme/classes/Yoast.php} +0 -0
  300. /package/lib/commands/create/creators/app/{template → chisel-starter-theme}/src/styles/elements/_hr.scss +0 -0
  301. /package/lib/commands/create/creators/{wp/template/wp → app/template}/.htaccess +0 -0
  302. /package/lib/commands/create/creators/{wp/template/wp → app/template}/wp-config.php +0 -0
@@ -0,0 +1,277 @@
1
+ <?php
2
+
3
+ namespace Chisel;
4
+
5
+ /**
6
+ * WordPress Theme setup related functionality.
7
+ *
8
+ * @package Chisel
9
+ */
10
+ class Theme implements Instance {
11
+
12
+ /**
13
+ * Post types that support post thumbnails.
14
+ *
15
+ * @var array
16
+ */
17
+ protected $post_thumbnails_post_types = array( 'post' );
18
+
19
+ /**
20
+ * Navigation menus.
21
+ *
22
+ * @var array
23
+ */
24
+ protected $nav_menus = array();
25
+
26
+ /**
27
+ * Class constructor.
28
+ */
29
+ private function __construct() {
30
+ $this->set_properties();
31
+ $this->action_hooks();
32
+ $this->filter_hooks();
33
+ }
34
+
35
+ /**
36
+ * Set properties.
37
+ */
38
+ public function set_properties() {
39
+ // Set nav menus to register.
40
+ $this->nav_menus = apply_filters(
41
+ 'chisel_nav_menus',
42
+ array(
43
+ 'chisel_main_nav' => __( 'Main Navigation', 'chisel' ),
44
+ 'chisel_footer_nav' => __( 'Footer Navigation', 'chisel' ),
45
+ )
46
+ );
47
+ }
48
+
49
+ /**
50
+ * Register action hooks.
51
+ */
52
+ public function action_hooks() {
53
+ add_action( 'after_setup_theme', array( $this, 'theme_supports' ) );
54
+ add_action( 'after_setup_theme', array( $this, 'remove_post_supports' ), 99 );
55
+ add_action( 'init', array( $this, 'register_nav_menus' ) );
56
+ add_action( 'after_setup_theme', array( $this, 'i18n' ) );
57
+ add_action( 'wp_head', array( $this, 'set_scrollbar_width_for_css' ) );
58
+ }
59
+
60
+ /**
61
+ * Register filter hooks.
62
+ */
63
+ public function filter_hooks() {
64
+ add_filter( 'body_class', array( $this, 'body_classes' ) );
65
+ add_filter( 'tiny_mce_before_init', array( $this, 'mce_custom_colors' ) );
66
+ add_filter( 'login_headertext', array( $this, 'login_headertext' ) );
67
+ add_filter( 'login_headerurl', array( $this, 'login_headerurl' ) );
68
+ }
69
+
70
+ /**
71
+ * Add theme supports.
72
+ */
73
+ public function theme_supports() {
74
+ $this->post_thumbnails_post_types = apply_filters( 'chisel_post_thumbnails_post_types', $this->post_thumbnails_post_types );
75
+
76
+ add_theme_support( 'post-formats', array() );
77
+ add_theme_support( 'post-thumbnails', $this->post_thumbnails_post_types );
78
+ add_theme_support( 'menus' );
79
+ add_theme_support( 'widgets' );
80
+
81
+ add_theme_support(
82
+ 'custom-logo',
83
+ array(
84
+ 'height' => 100,
85
+ 'width' => 400,
86
+ 'flex-height' => true,
87
+ 'flex-width' => true,
88
+ 'header-text' => array( 'site-title', 'site-description' ),
89
+ 'unlink-homepage-logo' => false,
90
+ )
91
+ );
92
+
93
+ add_theme_support(
94
+ 'html5',
95
+ array(
96
+ 'search-form',
97
+ 'comment-form',
98
+ 'comment-list',
99
+ 'gallery',
100
+ 'caption',
101
+ )
102
+ );
103
+
104
+ add_theme_support( 'responsive-embeds' ); // adds ratio class and styles to embeds.
105
+ }
106
+
107
+ /**
108
+ * Remove post supports.
109
+ */
110
+ public function remove_post_supports() {
111
+ remove_post_type_support( 'page', 'comments' );
112
+ remove_post_type_support( 'page', 'trackbacks' );
113
+ remove_post_type_support( 'page', 'excerpt' );
114
+ remove_post_type_support( 'attachment', 'comments' );
115
+ }
116
+
117
+ /**
118
+ * Register navigation menus.
119
+ */
120
+ public function register_nav_menus() {
121
+ register_nav_menus( $this->nav_menus );
122
+ }
123
+
124
+ /**
125
+ * Load theme internationalization files.
126
+ */
127
+ public function i18n() {
128
+ // Load user's custom translations from wp-content/languages/ folder.
129
+ load_textdomain(
130
+ 'chisel',
131
+ sprintf(
132
+ '%s/%s-%s.mo',
133
+ WP_LANG_DIR,
134
+ get_template(),
135
+ get_locale()
136
+ ),
137
+ );
138
+
139
+ // Load theme's available translations.
140
+ load_theme_textdomain(
141
+ 'chisel',
142
+ sprintf(
143
+ '%s/languages',
144
+ get_template_directory()
145
+ )
146
+ );
147
+ }
148
+
149
+ /**
150
+ * Calculate scrollbar width and set it as a CSS variable.
151
+ */
152
+ public function set_scrollbar_width_for_css() {
153
+ ?>
154
+ <script>
155
+ function getScrollbarWidth() {
156
+ return window.innerWidth - document.documentElement.clientWidth;
157
+ }
158
+
159
+ setTimeout(() => {
160
+ const scrollbarWidth = getScrollbarWidth();
161
+ document.documentElement.style.setProperty('--scrollbar-width', `${scrollbarWidth}px`);
162
+ }, 10);
163
+ </script>
164
+ <?php
165
+ }
166
+
167
+ /**
168
+ * Add custom classes to the body tag.
169
+ *
170
+ * @param array $classes
171
+ *
172
+ * @return array
173
+ */
174
+ public function body_classes( $classes ) {
175
+ $classes[] = 'chisel-theme';
176
+
177
+ return $classes;
178
+ }
179
+
180
+ /**
181
+ * This function will add custom colors pallette to tinymce editor
182
+ *
183
+ * @param array $settings
184
+ *
185
+ * @return array
186
+ */
187
+ public function mce_custom_colors( $settings ) {
188
+ $default_colors = '
189
+ "000000", "Black",
190
+ "993300", "Burnt orange",
191
+ "333300", "Dark olive",
192
+ "003300", "Dark green",
193
+ "003366", "Dark azure",
194
+ "000080", "Navy Blue",
195
+ "333399", "Indigo",
196
+ "333333", "Very dark gray",
197
+ "800000", "Maroon",
198
+ "FF6600", "Orange",
199
+ "808000", "Olive",
200
+ "008000", "Green",
201
+ "008080", "Teal",
202
+ "0000FF", "Blue",
203
+ "666699", "Grayish blue",
204
+ "808080", "Gray",
205
+ "FF0000", "Red",
206
+ "FF9900", "Amber",
207
+ "99CC00", "Yellow green",
208
+ "339966", "Sea green",
209
+ "33CCCC", "Turquoise",
210
+ "3366FF", "Royal blue",
211
+ "800080", "Purple",
212
+ "999999", "Medium gray",
213
+ "FF00FF", "Magenta",
214
+ "FFCC00", "Gold",
215
+ "FFFF00", "Yellow",
216
+ "00FF00", "Lime",
217
+ "00FFFF", "Aqua",
218
+ "00CCFF", "Sky blue",
219
+ "993366", "Brown",
220
+ "C0C0C0", "Silver",
221
+ "FF99CC", "Pink",
222
+ "FFCC99", "Peach",
223
+ "FFFF99", "Light yellow",
224
+ "CCFFCC", "Pale green",
225
+ "CCFFFF", "Pale cyan",
226
+ "99CCFF", "Light sky blue",
227
+ "CC99FF", "Plum",
228
+ "FFFFFF", "White"
229
+ ';
230
+
231
+ $custom_colors = Helpers::get_colors_palette( 'tinymce' );
232
+
233
+ $settings['textcolor_map'] = '[' . $default_colors . ',' . $custom_colors . ']';
234
+ $settings['textcolor_rows'] = 7; // expand colour grid to 7 rows.
235
+
236
+ return $settings;
237
+ }
238
+
239
+ /**
240
+ * Add custom login page logo text.
241
+ *
242
+ * @param string $text
243
+ *
244
+ * @return string
245
+ */
246
+ public function login_headertext( $text ) {
247
+ $text = esc_attr( get_bloginfo( 'name' ) );
248
+
249
+ return $text;
250
+ }
251
+
252
+ /**
253
+ * Add custom login page logo url.
254
+ *
255
+ * @param string $url
256
+ *
257
+ * @return string
258
+ */
259
+ public function login_headerurl( $url ) {
260
+ $url = esc_url( get_bloginfo( 'url' ) );
261
+
262
+ return $url;
263
+ }
264
+
265
+ /**
266
+ * Get the instance of the class.
267
+ */
268
+ public static function get_instance() {
269
+ static $instance = null;
270
+
271
+ if ( null === $instance ) {
272
+ $instance = new self();
273
+ }
274
+
275
+ return $instance;
276
+ }
277
+ }
@@ -0,0 +1,241 @@
1
+ <?php
2
+
3
+ namespace Chisel;
4
+
5
+ use Timber\Timber;
6
+
7
+ /**
8
+ * Class used to extend Timber functionality.
9
+ *
10
+ * @package Chisel
11
+ */
12
+ class Twig implements Instance {
13
+
14
+ /**
15
+ * Class constructor.
16
+ */
17
+ private function __construct() {
18
+ $this->set_properties();
19
+ $this->action_hooks();
20
+ $this->filter_hooks();
21
+ }
22
+
23
+ /**
24
+ * Set properties.
25
+ */
26
+ public function set_properties() {}
27
+
28
+ /**
29
+ * Register action hooks.
30
+ */
31
+ public function action_hooks() {
32
+ }
33
+
34
+ /**
35
+ * Register filter hooks.
36
+ */
37
+ public function filter_hooks() {
38
+ add_filter( 'timber/twig', array( $this, 'extend_twig' ) );
39
+ }
40
+
41
+ /**
42
+ * Extend Twig functionality.
43
+ *
44
+ * @param \Twig_Environment $twig The Twig environment.
45
+ * @return \Twig_Environment
46
+ */
47
+ public function extend_twig( $twig ) {
48
+ $twig = $this->register_functions( $twig );
49
+ $twig = $this->register_filters( $twig );
50
+ $twig = $this->register_tests( $twig );
51
+
52
+ return $twig;
53
+ }
54
+
55
+ /**
56
+ * Register custom Twig functions.
57
+ *
58
+ * @param \Twig_Environment $twig The Twig environment.
59
+ * @return \Twig_Environment
60
+ */
61
+ public function register_functions( $twig ) {
62
+ $this->register_function( $twig, 'get_nav_menu', array( $this, 'get_nav_menu' ) );
63
+ $this->register_function( $twig, 'timber_set_product', array( $this, 'timber_set_product' ) );
64
+ $this->register_function( $twig, 'post_classes', array( $this, 'post_classes' ) );
65
+ $this->register_function( $twig, 'slider_prepare_params', array( $this, 'slider_prepare_params' ) );
66
+ $this->register_function( $twig, 'get_responsive_image', array( $this, 'get_responsive_image' ) );
67
+
68
+ return $twig;
69
+ }
70
+
71
+ /**
72
+ * Register custom Twig filters.
73
+ *
74
+ * @param \Twig_Environment $twig The Twig environment.
75
+ * @return \Twig_Environment
76
+ */
77
+ public function register_filters( $twig ) {
78
+
79
+ return $twig;
80
+ }
81
+
82
+ /**
83
+ * Register custom Twig tests.
84
+ *
85
+ * @param \Twig_Environment $twig The Twig environment.
86
+ * @return \Twig_Environment
87
+ */
88
+ public function register_tests( $twig ) {
89
+
90
+ return $twig;
91
+ }
92
+
93
+ /**
94
+ * Register a Twig function.
95
+ *
96
+ * @param \Twig_Environment $twig The Twig environment.
97
+ * @param string $name The name of the function.
98
+ * @param callable $callback The callback function.
99
+ *
100
+ * @return \Twig_Environment
101
+ */
102
+ protected function register_function( $twig, $name, $callback ) {
103
+ $twig->addFunction( new \Twig\TwigFunction( $name, $callback ) );
104
+
105
+ return $twig;
106
+ }
107
+
108
+ /**
109
+ * Get the navigation menu.
110
+ *
111
+ * @param string $menu_name The menu name.
112
+ * @return string
113
+ */
114
+ public function get_nav_menu( $menu_name ) {
115
+ $context = Timber::context();
116
+
117
+ return $context['menus'][$menu_name];
118
+ }
119
+
120
+ /**
121
+ * Set the product object.
122
+ *
123
+ * @param object $post The post object.
124
+ */
125
+ public function timber_set_product( $post ) {
126
+ return Woocommerce::timber_set_product( $post );
127
+ }
128
+
129
+ /**
130
+ * Prepare post classnames to follow ITCSS structure.
131
+ *
132
+ * @param string $classes The post classes.
133
+ * @param string $prefix The prefix e.g. c-post--.
134
+ *
135
+ * @return string
136
+ */
137
+ public function post_classes( $classes, $prefix = 'c-post--' ) {
138
+ $classnames = explode( ' ', $classes );
139
+ $classnames = array_map(
140
+ function ( $classname ) use ( $prefix ) {
141
+ return $prefix . $classname;
142
+ },
143
+ $classnames
144
+ );
145
+
146
+ return implode( ' ', $classnames );
147
+ }
148
+
149
+ /**
150
+ * Prepare slider params for data attributes
151
+ *
152
+ * @param array $params
153
+ *
154
+ * @return array
155
+ */
156
+ public function slider_prepare_params( $params ) {
157
+ $defaults = array(
158
+ 'type' => 'default',
159
+ );
160
+ $prepared_params = array(
161
+ 'data' => array(),
162
+ 'attrs' => array(),
163
+ );
164
+
165
+ if ( isset( $params['block_settings'] ) ) {
166
+ $block_settings = $params['block_settings'];
167
+ $slider_settings = $block_settings['slider_settings'];
168
+ unset( $params['block_settings'] );
169
+
170
+ if ( in_array( 'arrows', $slider_settings, true ) ) {
171
+ $params['arrows'] = 'yes';
172
+ }
173
+
174
+ if ( in_array( 'dots', $slider_settings, true ) ) {
175
+ $params['dots'] = 'yes';
176
+ $dynamic_dots = isset( $block_settings['slider_settings_dynamic_dots'] ) ? esc_attr( $block_settings['slider_settings_dynamic_dots'] ) : 'no';
177
+
178
+ if ( $dynamic_dots === 'yes' ) {
179
+ $params['dots-dynamic'] = 1;
180
+ }
181
+ }
182
+
183
+ if ( in_array( 'loop', $slider_settings, true ) ) {
184
+ $params['loop'] = 'yes';
185
+ }
186
+
187
+ if ( in_array( 'autoplay', $slider_settings, true ) ) {
188
+ $autoplay_timeout = isset( $block_settings['slider_settings_autoplay_timeout'] ) ? absint( $block_settings['slider_settings_autoplay_timeout'] ) : 5000;
189
+ $params['autoplay'] = 'yes';
190
+ $params['autoplay-timeout'] = $autoplay_timeout;
191
+ }
192
+
193
+ if ( in_array( 'thumbnails', $slider_settings, true ) ) {
194
+ $thumbnails_no = isset( $block_settings['slider_settings_thumbnails_no'] ) ? absint( $block_settings['slider_settings_thumbnails_no'] ) : 8;
195
+ $params['thumbnails'] = $thumbnails_no;
196
+ }
197
+ }
198
+
199
+ if ( $params ) {
200
+ $params = wp_parse_args( $params, $defaults );
201
+
202
+ foreach ( $params as $param_name => $param_value ) {
203
+ if ( is_array( $param_value ) || is_object( $param_value ) ) {
204
+ $value = Helpers::json_encode_for_data_attribute( $param_value );
205
+ } else {
206
+ $value = sanitize_text_field( $param_value );
207
+ }
208
+
209
+ $prepared_params['data'][$param_name] = $value;
210
+ $prepared_params['attrs'][$param_name] = sprintf( 'data-%s="%s"', $param_name, $value );
211
+ }
212
+ }
213
+
214
+ return $prepared_params;
215
+ }
216
+
217
+ /**
218
+ * Get responsive image html
219
+ *
220
+ * @param int $image_id Image ID.
221
+ * @param string $image_size Image size.
222
+ *
223
+ * @return string
224
+ */
225
+ public function get_responsive_image( $image_id, $image_size ) {
226
+ return Timber::get_image( $image_id )->responsive( $image_size );
227
+ }
228
+
229
+ /**
230
+ * Get the instance of the class.
231
+ */
232
+ public static function get_instance() {
233
+ static $instance = null;
234
+
235
+ if ( null === $instance ) {
236
+ $instance = new self();
237
+ }
238
+
239
+ return $instance;
240
+ }
241
+ }
@@ -0,0 +1,183 @@
1
+ <?php
2
+ //phpcs:disable
3
+ namespace Chisel;
4
+
5
+ /**
6
+ * Class used to extend Timber functionality.
7
+ *
8
+ * @package Chisel
9
+ */
10
+ class Woocommerce implements Instance {
11
+
12
+ protected $sidebars = array();
13
+
14
+ /**
15
+ * Class constructor.
16
+ */
17
+ private function __construct() {
18
+ if ( ! self::is_woocommerce_active() ) {
19
+ return;
20
+ }
21
+
22
+ $this->set_properties();
23
+ $this->action_hooks();
24
+ $this->filter_hooks();
25
+ }
26
+
27
+ /**
28
+ * Set properties.
29
+ */
30
+ public function set_properties() {
31
+ $this->sidebars = array(
32
+ 'woocommerce' => array(
33
+ 'name' => __( 'Woocommerce', 'chisel' ),
34
+ 'description' => __( 'Sidebar for shop pages', 'chisel' ),
35
+ ),
36
+ );
37
+ }
38
+
39
+ /**
40
+ * Register action hooks.
41
+ */
42
+ public function action_hooks() {
43
+ $this->remove_actions();
44
+
45
+ add_action( 'after_setup_theme', array( $this, 'add_woocommerce_support' ) );
46
+
47
+ add_action( 'woocommerce_before_shop_loop', array( $this, 'before_shop_loop_div_open' ), 19 );
48
+ add_action( 'woocommerce_before_shop_loop', array( $this, 'before_shop_loop_div_close' ), 31 );
49
+ }
50
+
51
+ /**
52
+ * Register filter hooks.
53
+ */
54
+ public function filter_hooks() {
55
+ add_filter( 'chisel_sidebars', array( $this, 'register_sidebars' ) );
56
+ add_filter( 'woocommerce_enqueue_styles', array( $this, 'enqueue_styles' ) );
57
+ }
58
+
59
+ /**
60
+ * Remove WooCommerce actions.
61
+ */
62
+ public function remove_actions() {
63
+ // Remove loop product link open and close, so we can use our own.
64
+ remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
65
+ remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
66
+
67
+ remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
68
+ remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
69
+ remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
70
+
71
+ // Remove product default thumbnail.
72
+ remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail' );
73
+
74
+ remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
75
+
76
+ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
77
+ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
78
+
79
+ }
80
+
81
+ /**
82
+ * Add WooCommerce support.
83
+ */
84
+ public function add_woocommerce_support() {
85
+ add_theme_support( 'woocommerce' );
86
+ add_theme_support( 'wc-product-gallery-zoom' );
87
+ add_theme_support( 'wc-product-gallery-lightbox' );
88
+ add_theme_support( 'wc-product-gallery-slider' );
89
+ }
90
+
91
+ public function before_shop_loop_div_open() {
92
+ echo '<div class="c-shop__sort"> ';
93
+ }
94
+
95
+ public function before_shop_loop_div_close() {
96
+ echo ' </div> ';
97
+ }
98
+
99
+ public function register_sidebars( $sidebars ) {
100
+ $sidebars = array_merge( $sidebars, $this->sidebars );
101
+
102
+ return $sidebars;
103
+ }
104
+
105
+ /**
106
+ * Modify woocommerce enqueued styles.
107
+ *
108
+ * @param array $enqueue_styles
109
+ *
110
+ * @return array
111
+ */
112
+ public function enqueue_styles( $enqueue_styles ) {
113
+ unset( $enqueue_styles['woocommerce-layout'] );
114
+
115
+ return $enqueue_styles;
116
+ }
117
+
118
+ /**
119
+ * Set the product object. For some reason, products in the loop don’t get the right context by default. Without this, some elements of the listed products would show the same information as the first product in the loop. This function fixes that.
120
+ *
121
+ * @param object $post The post object.
122
+ */
123
+ public static function timber_set_product( $post ) {
124
+ global $product;
125
+
126
+ if ( is_woocommerce() ) {
127
+ $product = wc_get_product( $post->ID );
128
+ }
129
+ }
130
+
131
+ /**
132
+ * Check if WooCommerce is active.
133
+ *
134
+ * @return bool
135
+ */
136
+ public static function is_woocommerce_active() {
137
+ return class_exists( '\Woocommerce' );
138
+ }
139
+
140
+ public static function get_products_grid_classnames( $products, $has_sidebar ) {
141
+ $loop_columns = wc_get_loop_prop( 'columns' );
142
+
143
+ // Set max columns to 4.
144
+ if ( $loop_columns > 4 ) {
145
+ $loop_columns = 4;
146
+ }
147
+
148
+ $columns_data = array(
149
+ 'medium' => $loop_columns,
150
+ 'small' => $loop_columns > 2 ? $loop_columns - 1 : $loop_columns,
151
+ );
152
+
153
+ $grid_classnames = array(
154
+ 'o-grid',
155
+ 'o-grid--cols-1',
156
+ );
157
+
158
+ if ( $products ) {
159
+ $grid_classnames[] = 'o-grid--cols-' . $columns_data['small'] . '-small';
160
+
161
+ if ( $has_sidebar ) {
162
+ $grid_classnames[] = 'o-grid--cols-' . $columns_data['small'] . '-medium';
163
+ } else {
164
+ $grid_classnames[] = 'o-grid--cols-' . $columns_data['medium'] . '-medium';
165
+ }
166
+ }
167
+
168
+ return implode( ' ', $grid_classnames );
169
+ }
170
+
171
+ /**
172
+ * Get the instance of the class.
173
+ */
174
+ public static function get_instance() {
175
+ static $instance = null;
176
+
177
+ if ( null === $instance ) {
178
+ $instance = new self();
179
+ }
180
+
181
+ return $instance;
182
+ }
183
+ }