generator-chisel 2.3.3 → 2.4.0

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 (113) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/lib/commands/create/creators/app/chisel-starter-theme/.editorconfig +16 -0
  3. package/lib/commands/create/creators/app/chisel-starter-theme/.husky/pre-commit +92 -0
  4. package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -1
  5. package/lib/commands/create/creators/app/chisel-starter-theme/README.md +67 -10
  6. package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/search.svg +3 -0
  7. package/lib/commands/create/creators/app/chisel-starter-theme/composer.json +3 -3
  8. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP/AjaxEndpoints.php → core/Ajax/LoadMoreEndpoint.php} +8 -51
  9. package/lib/commands/create/creators/app/chisel-starter-theme/core/Controllers/AjaxController.php +225 -0
  10. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AcfHelpers.php +4 -0
  11. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AjaxHelpers.php +4 -0
  12. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AssetsHelpers.php +4 -0
  13. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/BlocksHelpers.php +5 -0
  14. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/CacheHelpers.php +5 -1
  15. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/CommentsHelpers.php +4 -0
  16. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/DataHelpers.php +4 -0
  17. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/GravityFormsHelpers.php +4 -0
  18. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/ImageHelpers.php +4 -0
  19. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/ThemeHelpers.php +10 -2
  20. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/WoocommerceHelpers.php +4 -0
  21. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/YoastHelpers.php +4 -0
  22. package/lib/commands/create/creators/app/chisel-starter-theme/core/Interfaces/AjaxEndpointInterface.php +15 -0
  23. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/Plugins → core/Plugins/GravityForms}/GravityForms.php +12 -24
  24. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/Plugins → core/Plugins/Woocommerce}/Woocommerce.php +23 -14
  25. package/lib/commands/create/creators/app/chisel-starter-theme/core/Plugins/Yoast/Yoast.php +37 -0
  26. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/Cache.php +5 -17
  27. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselImage.php +1 -1
  28. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselPost.php +1 -1
  29. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselProduct.php +1 -1
  30. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselProductCategory.php +1 -1
  31. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselTerm.php +1 -1
  32. package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/Components.php +1 -1
  33. package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/Hooks.php +29 -0
  34. package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/HooksSingleton.php +54 -0
  35. package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/Rest.php +51 -0
  36. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Traits/Singleton.php +10 -8
  37. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Acf.php +22 -55
  38. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/AcfBlocks.php +7 -20
  39. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Assets.php +3 -15
  40. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Blocks.php +7 -19
  41. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Comments.php +44 -49
  42. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/CustomPostTypes.php +8 -35
  43. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/CustomTaxonomies.php +12 -36
  44. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Sidebars.php +3 -15
  45. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Site.php +52 -18
  46. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Theme.php +4 -15
  47. package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Twig.php +12 -31
  48. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/Timber/ChiselPost.php +14 -0
  49. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Acf.php +66 -0
  50. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Ajax.php +45 -0
  51. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Assets.php +37 -0
  52. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/CustomPostTypes.php +76 -0
  53. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Site.php +42 -0
  54. package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Twig.php +52 -0
  55. package/lib/commands/create/creators/app/chisel-starter-theme/custom/functions.php +8 -0
  56. package/lib/commands/create/creators/app/chisel-starter-theme/custom/views/README.md +7 -0
  57. package/lib/commands/create/creators/app/chisel-starter-theme/functions.php +27 -10
  58. package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +9 -4
  59. package/lib/commands/create/creators/app/chisel-starter-theme/phpcs.xml +10 -0
  60. package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/block.json +1 -1
  61. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +1 -1
  62. package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_breakpoints.scss +1 -0
  63. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core.js +11 -2
  64. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/main-nav.js +14 -2
  65. package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/slider.js +45 -4
  66. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +11 -2
  67. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_search-form.scss +17 -0
  68. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_slider.scss +3 -3
  69. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-base.scss +117 -0
  70. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-collapse.scss.disabled +66 -0
  71. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-elastic.scss.disabled +56 -0
  72. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-emphatic.scss.disabled +59 -0
  73. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-settings.scss +22 -0
  74. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-slider.scss +59 -0
  75. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-spin.scss.disabled +60 -0
  76. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-spring.scss.disabled +98 -0
  77. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-squeeze.scss.disabled +47 -0
  78. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-stand.scss.disabled +59 -0
  79. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-three-d.scss.disabled +139 -0
  80. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-vortex.scss.disabled +61 -0
  81. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/gravity-forms.scss +17 -1
  82. package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +1 -1
  83. package/lib/commands/create/creators/app/chisel-starter-theme/theme.json +1 -1
  84. package/lib/commands/create/creators/app/chisel-starter-theme/twig_cs.php +4 -2
  85. package/lib/commands/create/creators/app/chisel-starter-theme/views/base.twig +1 -2
  86. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/footer.twig +19 -11
  87. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/header.twig +6 -2
  88. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/logo.twig +6 -2
  89. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav.twig +1 -1
  90. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/post-item.twig +38 -20
  91. package/lib/commands/create/creators/app/chisel-starter-theme/views/components/search-form.twig +8 -0
  92. package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +19 -10
  93. package/lib/commands/create/creators/app/chisel-starter-theme/views/search.twig +5 -6
  94. package/lib/commands/create/creators/app/chisel-starter-theme/views/single.twig +43 -31
  95. package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/content-product.twig +1 -1
  96. package/lib/commands/create/creators/app/index.js +87 -9
  97. package/lib/commands/create/creators/wp/index.js +10 -2
  98. package/lib/commands/create/packages-versions.js +2 -2
  99. package/lib/commands/create/priorities.js +3 -0
  100. package/package.json +2 -2
  101. package/lib/commands/create/creators/app/chisel-starter-theme/inc/Controllers/AjaxController.php +0 -156
  102. package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/HooksInterface.php +0 -26
  103. package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/InstanceInterface.php +0 -16
  104. package/lib/commands/create/creators/app/chisel-starter-theme/inc/Plugins/Yoast.php +0 -46
  105. package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav-toggle.scss +0 -804
  106. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Enums/AcfOptionsPageType.php +0 -0
  107. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Enums/BlocksType.php +0 -0
  108. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterAcfOptionsPage.php +0 -0
  109. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterBlocks.php +0 -0
  110. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterCustomPostType.php +0 -0
  111. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterCustomTaxonomy.php +0 -0
  112. /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Traits/PageBlocks.php +0 -0
  113. /package/lib/commands/create/creators/app/chisel-starter-theme/{src/scripts/blog.js → custom/app/Ajax/.gitkeep} +0 -0
@@ -3,9 +3,7 @@
3
3
  namespace Chisel\WP;
4
4
 
5
5
  use Timber\Timber;
6
- use Chisel\Interfaces\InstanceInterface;
7
- use Chisel\Interfaces\HooksInterface;
8
- use Chisel\Traits\Singleton;
6
+ use Chisel\Traits\HooksSingleton;
9
7
  use Chisel\Factories\RegisterBlocks;
10
8
  use Chisel\Traits\PageBlocks;
11
9
  use Chisel\Helpers\BlocksHelpers;
@@ -16,9 +14,9 @@ use Chisel\Helpers\AssetsHelpers;
16
14
  *
17
15
  * @package Chisel
18
16
  */
19
- final class AcfBlocks implements InstanceInterface, HooksInterface {
17
+ final class AcfBlocks {
20
18
 
21
- use Singleton;
19
+ use HooksSingleton;
22
20
  use PageBlocks;
23
21
 
24
22
  /**
@@ -42,31 +40,20 @@ final class AcfBlocks implements InstanceInterface, HooksInterface {
42
40
  */
43
41
  public string $blocks_twig_base_path = '';
44
42
 
45
- /**
46
- * Class constructor.
47
- */
48
- private function __construct() {
49
- $this->register_blocks_factory = new RegisterBlocks( 'acf' );
50
- $this->blocks = $this->register_blocks_factory->get_blocks();
51
-
52
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
53
- add_action( 'wp_print_styles', array( $this, 'dequeue_blocks_styles' ), 999 );
54
-
55
- $this->action_hooks();
56
- $this->filter_hooks();
57
- }
58
-
59
43
  /**
60
44
  * Set properties.
61
45
  */
62
46
  public function set_properties(): void {
63
- $this->blocks_twig_base_path = 'build/blocks-acf/';
47
+ $this->register_blocks_factory = new RegisterBlocks( 'acf' );
48
+ $this->blocks = $this->register_blocks_factory->get_blocks();
49
+ $this->blocks_twig_base_path = 'build/blocks-acf/';
64
50
  }
65
51
 
66
52
  /**
67
53
  * Register action hooks.
68
54
  */
69
55
  public function action_hooks(): void {
56
+ add_action( 'wp_print_styles', array( $this, 'dequeue_blocks_styles' ), 999 );
70
57
  add_action( 'acf/init', array( $this, 'register_blocks' ) );
71
58
  }
72
59
 
@@ -2,9 +2,7 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
  use Chisel\Helpers\ThemeHelpers;
9
7
  use Chisel\Helpers\AjaxHelpers;
10
8
  use Chisel\Helpers\AssetsHelpers;
@@ -14,9 +12,9 @@ use Chisel\Helpers\AssetsHelpers;
14
12
  *
15
13
  * @package Chisel
16
14
  */
17
- final class Assets implements InstanceInterface, HooksInterface {
15
+ final class Assets {
18
16
 
19
- use Singleton;
17
+ use HooksSingleton;
20
18
 
21
19
  /**
22
20
  * Front-end styles to be registered and enqueued.
@@ -88,16 +86,6 @@ final class Assets implements InstanceInterface, HooksInterface {
88
86
  */
89
87
  private string $refresh_runtime_dependency = 'wp-react-refresh-runtime';
90
88
 
91
- /**
92
- * Class constructor.
93
- */
94
- private function __construct() {
95
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
96
-
97
- $this->action_hooks();
98
- $this->filter_hooks();
99
- }
100
-
101
89
  /**
102
90
  * Set properties.
103
91
  */
@@ -4,9 +4,7 @@ namespace Chisel\WP;
4
4
 
5
5
  use Timber\Timber;
6
6
 
7
- use Chisel\Interfaces\InstanceInterface;
8
- use Chisel\Interfaces\HooksInterface;
9
- use Chisel\Traits\Singleton;
7
+ use Chisel\Traits\HooksSingleton;
10
8
  use Chisel\Factories\RegisterBlocks;
11
9
  use Chisel\Helpers\BlocksHelpers;
12
10
  use Chisel\Helpers\ThemeHelpers;
@@ -17,9 +15,9 @@ use Chisel\Traits\PageBlocks;
17
15
  *
18
16
  * @package Chisel
19
17
  */
20
- final class Blocks implements InstanceInterface, HooksInterface {
18
+ final class Blocks {
21
19
 
22
- use Singleton;
20
+ use HooksSingleton;
23
21
  use PageBlocks;
24
22
 
25
23
  /**
@@ -71,25 +69,15 @@ final class Blocks implements InstanceInterface, HooksInterface {
71
69
  *
72
70
  * @var string
73
71
  */
74
- private string $blocks_twig_base_path = 'build/blocks/';
75
-
76
- /**
77
- * Class constructor.
78
- */
79
- private function __construct() {
80
- $this->register_blocks_factory = new RegisterBlocks( 'wp' );
81
- $this->blocks = $this->register_blocks_factory->get_blocks();
82
-
83
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
84
-
85
- $this->action_hooks();
86
- $this->filter_hooks();
87
- }
72
+ public string $blocks_twig_base_path = '';
88
73
 
89
74
  /**
90
75
  * Set properties.
91
76
  */
92
77
  public function set_properties(): void {
78
+ $this->register_blocks_factory = new RegisterBlocks( 'wp' );
79
+ $this->blocks = $this->register_blocks_factory->get_blocks();
80
+ $this->blocks_twig_base_path = 'build/blocks/';
93
81
  $this->theme = wp_get_theme();
94
82
  $this->blocks_category = 'chisel-blocks';
95
83
  $this->block_patterns_categories_namespace = 'chisel-patterns';
@@ -2,18 +2,16 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
 
9
7
  /**
10
8
  * Comments related functionalities.
11
9
  *
12
10
  * @package Chisel
13
11
  */
14
- final class Comments implements InstanceInterface, HooksInterface {
12
+ final class Comments {
15
13
 
16
- use Singleton;
14
+ use HooksSingleton;
17
15
 
18
16
  /**
19
17
  * Disable comments
@@ -32,69 +30,66 @@ final class Comments implements InstanceInterface, HooksInterface {
32
30
  'page',
33
31
  );
34
32
 
35
- /**
36
- * Class constructor.
37
- */
38
- private function __construct() {
39
- $this->set_properties();
40
-
41
- if ( $this->disable_comments ) {
42
- $this->action_hooks();
43
- $this->filter_hooks();
44
- }
45
- }
46
-
47
33
  /**
48
34
  * Set properties.
49
35
  */
50
36
  public function set_properties(): void {
51
- $this->disable_comments = apply_filters( 'chisel_disable_comments', true );
37
+ $this->disable_comments = apply_filters( 'chisel_disable_comments', $this->disable_comments );
52
38
  }
53
39
 
54
40
  /**
55
41
  * Register action hooks.
56
42
  */
57
43
  public function action_hooks(): void {
58
- add_action( 'after_setup_theme', array( $this, 'disable_comments_for_post_types' ), 99 );
59
- add_action( 'admin_menu', array( $this, 'remove_admin_menu' ), 999 );
44
+ if ( $this->disable_comments === false ) {
45
+ return;
46
+ }
47
+
48
+ add_action( 'after_setup_theme', array( $this, 'disable_comments_for_post_types' ), 99 );
49
+ add_action( 'admin_menu', array( $this, 'remove_admin_menu' ), 999 );
60
50
 
61
- add_action( 'admin_print_styles-index.php', array( $this, 'admin_css' ) );
62
- add_action( 'admin_print_styles-profile.php', array( $this, 'admin_css' ) );
63
- add_action( 'wp_dashboard_setup', array( $this, 'filter_dashboard' ) );
51
+ add_action( 'admin_print_styles-index.php', array( $this, 'admin_css' ) );
52
+ add_action( 'admin_print_styles-profile.php', array( $this, 'admin_css' ) );
53
+ add_action( 'wp_dashboard_setup', array( $this, 'filter_dashboard' ) );
64
54
 
65
- add_action( 'widgets_init', array( $this, 'disable_rc_widget' ) );
66
- add_action( 'template_redirect', array( $this, 'filter_query' ), 9 ); // before redirect_canonical.
67
- add_action( 'add_admin_bar_menus', array( $this, 'filter_admin_bar' ), 0 );
68
- add_action( 'admin_init', array( $this, 'filter_admin_bar' ) );
55
+ add_action( 'widgets_init', array( $this, 'disable_rc_widget' ) );
56
+ add_action( 'template_redirect', array( $this, 'filter_query' ), 9 ); // before redirect_canonical.
57
+ add_action( 'add_admin_bar_menus', array( $this, 'filter_admin_bar' ), 0 );
58
+ add_action( 'admin_init', array( $this, 'filter_admin_bar' ) );
69
59
 
70
- add_action( 'template_redirect', array( $this, 'check_comment_template' ) );
71
- add_action( 'enqueue_block_editor_assets', array( $this, 'filter_gutenberg' ) );
60
+ add_action( 'template_redirect', array( $this, 'check_comment_template' ) );
61
+ add_action( 'enqueue_block_editor_assets', array( $this, 'filter_gutenberg' ) );
72
62
  }
73
63
 
74
64
  /**
75
65
  * Register filter hooks.
76
66
  */
77
67
  public function filter_hooks(): void {
78
- add_filter( 'wp_headers', array( $this, 'filter_wp_headers' ) );
79
- add_filter( 'pre_option_default_pingback_flag', '__return_zero' );
80
- add_filter( 'comments_open', '__return_false', 20 );
81
- add_filter( 'pings_open', '__return_false', 20 );
82
-
83
- // Remove comments links from feed.
84
- add_filter( 'post_comments_feed_link', '__return_false' );
85
- add_filter( 'comments_link_feed', '__return_false' );
86
- add_filter( 'comment_link', '__return_false' );
87
-
88
- // Remove comment count from feed.
89
- add_filter( 'get_comments_number', '__return_false' );
90
-
91
- // Remove feed link from header.
92
- add_filter( 'feed_links_show_comments_feed', '__return_false' );
93
-
94
- add_filter( 'rest_endpoints', array( $this, 'filter_rest_endpoints' ) );
95
- add_filter( 'xmlrpc_methods', array( $this, 'disable_xmlrc_comments' ) );
96
- add_filter( 'rest_pre_insert_comment', array( $this, 'disable_rest_api_comments' ), 10, 2 );
97
- add_filter( 'comments_array', '__return_empty_array', 20 );
68
+
69
+ if ( $this->disable_comments === false ) {
70
+ return;
71
+ }
72
+
73
+ add_filter( 'wp_headers', array( $this, 'filter_wp_headers' ) );
74
+ add_filter( 'pre_option_default_pingback_flag', '__return_zero' );
75
+ add_filter( 'comments_open', '__return_false', 20 );
76
+ add_filter( 'pings_open', '__return_false', 20 );
77
+
78
+ // Remove comments links from feed.
79
+ add_filter( 'post_comments_feed_link', '__return_false' );
80
+ add_filter( 'comments_link_feed', '__return_false' );
81
+ add_filter( 'comment_link', '__return_false' );
82
+
83
+ // Remove comment count from feed.
84
+ add_filter( 'get_comments_number', '__return_false' );
85
+
86
+ // Remove feed link from header.
87
+ add_filter( 'feed_links_show_comments_feed', '__return_false' );
88
+
89
+ add_filter( 'rest_endpoints', array( $this, 'filter_rest_endpoints' ) );
90
+ add_filter( 'xmlrpc_methods', array( $this, 'disable_xmlrc_comments' ) );
91
+ add_filter( 'rest_pre_insert_comment', array( $this, 'disable_rest_api_comments' ), 10, 2 );
92
+ add_filter( 'comments_array', '__return_empty_array', 20 );
98
93
  }
99
94
 
100
95
  /**
@@ -2,9 +2,7 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
  use Chisel\Factories\RegisterCustomPostType;
9
7
 
10
8
  /**
@@ -12,9 +10,9 @@ use Chisel\Factories\RegisterCustomPostType;
12
10
  *
13
11
  * @package Chisel
14
12
  */
15
- final class CustomPostTypes implements InstanceInterface, HooksInterface {
13
+ final class CustomPostTypes {
16
14
 
17
- use Singleton;
15
+ use HooksSingleton;
18
16
 
19
17
  /**
20
18
  * Post types.
@@ -37,16 +35,6 @@ final class CustomPostTypes implements InstanceInterface, HooksInterface {
37
35
  */
38
36
  private array $default_post_type_rewrite_args = array();
39
37
 
40
- /**
41
- * Class constructor.
42
- */
43
- private function __construct() {
44
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
45
-
46
- $this->action_hooks();
47
- $this->filter_hooks();
48
- }
49
-
50
38
  /**
51
39
  * Set properties.
52
40
  */
@@ -62,8 +50,6 @@ final class CustomPostTypes implements InstanceInterface, HooksInterface {
62
50
  'ep_mask' => EP_PERMALINK,
63
51
  )
64
52
  );
65
-
66
- $this->set_post_types();
67
53
  }
68
54
 
69
55
  /**
@@ -100,24 +86,11 @@ final class CustomPostTypes implements InstanceInterface, HooksInterface {
100
86
  }
101
87
 
102
88
  /**
103
- * Set custom post types.
89
+ * Get custom post types.
90
+ *
91
+ * @return array
104
92
  */
105
- private function set_post_types(): void {
106
- $this->post_types = array(
107
- // phpcs:disable
108
- // 'chisel-cpt' => array(
109
- // 'singular' => __( 'Chisel CPT', 'chisel' ),
110
- // 'plural' => __( 'Chisel CPTs', 'chisel' ),
111
- // 'supports' => array( 'editor', 'thumbnail', 'excerpt' ),
112
- // 'menu_icon' => 'dashicons-location-alt',
113
- // 'hierarchical' => true,
114
- // 'public' => true,
115
- // 'menu_position' => 20,
116
- // 'rewrite' => array(
117
- // 'slug' => 'chisel-post',
118
- // ),
119
- // ),
120
- // phpcs:enable
121
- );
93
+ public static function get_post_types(): array {
94
+ return self::get_instance()->post_types;
122
95
  }
123
96
  }
@@ -2,9 +2,7 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
  use Chisel\Factories\RegisterCustomTaxonomy;
9
7
 
10
8
  /**
@@ -12,9 +10,9 @@ use Chisel\Factories\RegisterCustomTaxonomy;
12
10
  *
13
11
  * @package Chisel
14
12
  */
15
- final class CustomTaxonomies implements InstanceInterface, HooksInterface {
13
+ final class CustomTaxonomies {
16
14
 
17
- use Singleton;
15
+ use HooksSingleton;
18
16
 
19
17
  /**
20
18
  * Taxonomies.
@@ -37,16 +35,6 @@ final class CustomTaxonomies implements InstanceInterface, HooksInterface {
37
35
  */
38
36
  private array $default_taxonomy_capabilities = array();
39
37
 
40
- /**
41
- * Class constructor.
42
- */
43
- private function __construct() {
44
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
45
-
46
- $this->action_hooks();
47
- $this->filter_hooks();
48
- }
49
-
50
38
  /**
51
39
  * Set properties.
52
40
  */
@@ -69,8 +57,6 @@ final class CustomTaxonomies implements InstanceInterface, HooksInterface {
69
57
  'ep_mask' => EP_NONE,
70
58
  )
71
59
  );
72
-
73
- $this->set_taxonomies();
74
60
  }
75
61
 
76
62
  /**
@@ -85,6 +71,15 @@ final class CustomTaxonomies implements InstanceInterface, HooksInterface {
85
71
  */
86
72
  public function filter_hooks(): void {}
87
73
 
74
+ /**
75
+ * Get taxonomies.
76
+ *
77
+ * @return array
78
+ */
79
+ public static function get_taxonomies(): array {
80
+ return self::get_instance()->taxonomies;
81
+ }
82
+
88
83
  /**
89
84
  * Register custom taxonomies.
90
85
  */
@@ -106,23 +101,4 @@ final class CustomTaxonomies implements InstanceInterface, HooksInterface {
106
101
  $register_custom_taxonomy_factory->register_taxonomy();
107
102
  }
108
103
  }
109
-
110
- /**
111
- * Set custom taxonomies.
112
- */
113
- private function set_taxonomies(): void {
114
- $this->taxonomies = array(
115
- // phpcs:disable
116
- // 'chisel-term' => array(
117
- // 'singular' => __( 'Chisel Term', 'chisel' ),
118
- // 'plural' => __( 'Chisel Terms', 'chisel' ),
119
- // 'post_types' => array( 'chisel-cpt' ),
120
- // 'public' => true,
121
- // 'rewrite' => array(
122
- // 'slug' => 'chisel-term',
123
- // ),
124
- // ),
125
- // phpcs:enable
126
- );
127
- }
128
104
  }
@@ -2,18 +2,16 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
 
9
7
  /**
10
8
  * WordPress Sidebars setup related functionality.
11
9
  *
12
10
  * @package Chisel
13
11
  */
14
- class Sidebars implements InstanceInterface, HooksInterface {
12
+ final class Sidebars {
15
13
 
16
- use Singleton;
14
+ use HooksSingleton;
17
15
 
18
16
  /**
19
17
  * Sidebars to register.
@@ -22,16 +20,6 @@ class Sidebars implements InstanceInterface, HooksInterface {
22
20
  */
23
21
  private array $sidebars = array();
24
22
 
25
- /**
26
- * Class constructor.
27
- */
28
- private function __construct() {
29
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
30
-
31
- $this->action_hooks();
32
- $this->filter_hooks();
33
- }
34
-
35
23
  /**
36
24
  * Set properties.
37
25
  */
@@ -5,36 +5,32 @@ namespace Chisel\WP;
5
5
  use Timber\Timber;
6
6
  use Timber\Site as TimberSite;
7
7
 
8
- use Chisel\Interfaces\InstanceInterface;
9
- use Chisel\Interfaces\HooksInterface;
10
- use Chisel\Traits\Singleton;
8
+ use Chisel\Traits\HooksSingleton;
9
+ use Chisel\Timber\ChiselImage;
10
+ use Chisel\Timber\ChiselPost;
11
+ use Chisel\Timber\ChiselProduct;
12
+ use Chisel\Timber\ChiselProductCategory;
13
+ use Chisel\Timber\ChiselTerm;
14
+ use Chisel\Timber\Components;
11
15
 
12
16
  /**
13
17
  * Site related functionality related to timber.
14
18
  *
15
19
  * @package Chisel
16
20
  */
17
- final class Site extends TimberSite implements InstanceInterface, HooksInterface {
21
+ final class Site extends TimberSite {
18
22
 
19
- use Singleton;
23
+ use HooksSingleton;
20
24
 
21
25
  /**
22
- * Class constructor.
26
+ * Call parent constructor.
27
+ *
28
+ * @return bool
23
29
  */
24
- private function __construct() {
25
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
26
-
27
- $this->action_hooks();
28
- $this->filter_hooks();
29
-
30
- parent::__construct();
30
+ protected function should_call_parent_construct(): bool {
31
+ return true;
31
32
  }
32
33
 
33
- /**
34
- * Set properties.
35
- */
36
- public function set_properties(): void {}
37
-
38
34
  /**
39
35
  * Register action hooks.
40
36
  */
@@ -44,11 +40,33 @@ final class Site extends TimberSite implements InstanceInterface, HooksInterface
44
40
  * Register filter hooks.
45
41
  */
46
42
  public function filter_hooks(): void {
43
+ add_filter( 'timber/locations', array( $this, 'tiwg_files_locations' ) );
47
44
  add_filter( 'timber/context', array( $this, 'add_to_context' ) );
48
45
  add_filter( 'timber/post/classmap', array( $this, 'post_classmap' ) );
49
46
  add_filter( 'timber/term/classmap', array( $this, 'term_classmap' ) );
50
47
  }
51
48
 
49
+ /**
50
+ * Add custom Timber files locations. Let views in custom directory override default views.
51
+ *
52
+ * @param array $locations The locations.
53
+ *
54
+ * @return array
55
+ */
56
+ public function tiwg_files_locations( array $locations ): array {
57
+ $custom_templates = get_template_directory() . '/custom/views/';
58
+
59
+ if ( is_dir( $custom_templates ) ) {
60
+ if ( isset( $locations['__main__'] ) ) {
61
+ array_unshift( $locations['__main__'], $custom_templates );
62
+ } else {
63
+ array_unshift( $locations, $custom_templates );
64
+ }
65
+ }
66
+
67
+ return $locations;
68
+ }
69
+
52
70
  /**
53
71
  * Add data to the context.
54
72
  *
@@ -80,6 +98,14 @@ final class Site extends TimberSite implements InstanceInterface, HooksInterface
80
98
  'attachment' => ChiselImage::class,
81
99
  );
82
100
 
101
+ $custom_post_types = CustomPostTypes::get_post_types();
102
+
103
+ foreach ( $custom_post_types as $cpt => $data ) {
104
+ if ( ! isset( $custom_classmap[$cpt] ) ) {
105
+ $custom_classmap[$cpt] = ChiselPost::class;
106
+ }
107
+ }
108
+
83
109
  return array_merge( $classmap, $custom_classmap );
84
110
  }
85
111
 
@@ -95,6 +121,14 @@ final class Site extends TimberSite implements InstanceInterface, HooksInterface
95
121
  'product_cat' => ChiselProductCategory::class,
96
122
  );
97
123
 
124
+ $custom_taxonomies = CustomTaxonomies::get_taxonomies();
125
+
126
+ foreach ( $custom_taxonomies as $taxonomy => $data ) {
127
+ if ( ! isset( $custom_classmap[$taxonomy] ) ) {
128
+ $custom_classmap[$taxonomy] = ChiselTerm::class;
129
+ }
130
+ }
131
+
98
132
  return array_merge( $classmap, $custom_classmap );
99
133
  }
100
134
  }
@@ -2,9 +2,7 @@
2
2
 
3
3
  namespace Chisel\WP;
4
4
 
5
- use Chisel\Interfaces\InstanceInterface;
6
- use Chisel\Interfaces\HooksInterface;
7
- use Chisel\Traits\Singleton;
5
+ use Chisel\Traits\HooksSingleton;
8
6
  use Chisel\Helpers\ThemeHelpers;
9
7
 
10
8
  /**
@@ -12,9 +10,9 @@ use Chisel\Helpers\ThemeHelpers;
12
10
  *
13
11
  * @package Chisel
14
12
  */
15
- final class Theme implements InstanceInterface, HooksInterface {
13
+ final class Theme {
16
14
 
17
- use Singleton;
15
+ use HooksSingleton;
18
16
 
19
17
  /**
20
18
  * Post types that support post thumbnails.
@@ -30,16 +28,6 @@ final class Theme implements InstanceInterface, HooksInterface {
30
28
  */
31
29
  private array $nav_menus = array();
32
30
 
33
- /**
34
- * Class constructor.
35
- */
36
- private function __construct() {
37
- add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
38
-
39
- $this->action_hooks();
40
- $this->filter_hooks();
41
- }
42
-
43
31
  /**
44
32
  * Set properties.
45
33
  */
@@ -83,6 +71,7 @@ final class Theme implements InstanceInterface, HooksInterface {
83
71
  public function theme_supports(): void {
84
72
  $this->post_thumbnails_post_types = (array) apply_filters( 'chisel_post_thumbnails_post_types', $this->post_thumbnails_post_types );
85
73
 
74
+ add_theme_support( 'title-tag' );
86
75
  add_theme_support( 'post-formats', array() );
87
76
  add_theme_support( 'post-thumbnails', $this->post_thumbnails_post_types );
88
77
  add_theme_support( 'menus' );