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.
- package/CHANGELOG.md +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.editorconfig +16 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.husky/pre-commit +92 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/README.md +67 -10
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/search.svg +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/composer.json +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP/AjaxEndpoints.php → core/Ajax/LoadMoreEndpoint.php} +8 -51
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Controllers/AjaxController.php +225 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AcfHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AjaxHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AssetsHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/BlocksHelpers.php +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/CacheHelpers.php +5 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/CommentsHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/DataHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/GravityFormsHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/ImageHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/ThemeHelpers.php +10 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/WoocommerceHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/YoastHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Interfaces/AjaxEndpointInterface.php +15 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/Plugins → core/Plugins/GravityForms}/GravityForms.php +12 -24
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/Plugins → core/Plugins/Woocommerce}/Woocommerce.php +23 -14
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Plugins/Yoast/Yoast.php +37 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/Cache.php +5 -17
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselImage.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselPost.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselProduct.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselProductCategory.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselTerm.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/Components.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/Hooks.php +29 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/HooksSingleton.php +54 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/Rest.php +51 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Traits/Singleton.php +10 -8
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Acf.php +22 -55
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/AcfBlocks.php +7 -20
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Assets.php +3 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Blocks.php +7 -19
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Comments.php +44 -49
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/CustomPostTypes.php +8 -35
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/CustomTaxonomies.php +12 -36
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Sidebars.php +3 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Site.php +52 -18
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Theme.php +4 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Twig.php +12 -31
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/Timber/ChiselPost.php +14 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Acf.php +66 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Ajax.php +45 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Assets.php +37 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/CustomPostTypes.php +76 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Site.php +42 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Twig.php +52 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/functions.php +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/views/README.md +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/functions.php +27 -10
- package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +9 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/phpcs.xml +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/block.json +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_breakpoints.scss +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core.js +11 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/main-nav.js +14 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/slider.js +45 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +11 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_search-form.scss +17 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_slider.scss +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-base.scss +117 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-collapse.scss.disabled +66 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-elastic.scss.disabled +56 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-emphatic.scss.disabled +59 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-settings.scss +22 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-slider.scss +59 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-spin.scss.disabled +60 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-spring.scss.disabled +98 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-squeeze.scss.disabled +47 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-stand.scss.disabled +59 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-three-d.scss.disabled +139 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-vortex.scss.disabled +61 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/gravity-forms.scss +17 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/theme.json +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/twig_cs.php +4 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/base.twig +1 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/footer.twig +19 -11
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/header.twig +6 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/logo.twig +6 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav.twig +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/post-item.twig +38 -20
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/search-form.twig +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +19 -10
- package/lib/commands/create/creators/app/chisel-starter-theme/views/search.twig +5 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/views/single.twig +43 -31
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/content-product.twig +1 -1
- package/lib/commands/create/creators/app/index.js +87 -9
- package/lib/commands/create/creators/wp/index.js +10 -2
- package/lib/commands/create/packages-versions.js +2 -2
- package/lib/commands/create/priorities.js +3 -0
- package/package.json +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Controllers/AjaxController.php +0 -156
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/HooksInterface.php +0 -26
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/InstanceInterface.php +0 -16
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Plugins/Yoast.php +0 -46
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav-toggle.scss +0 -804
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Enums/AcfOptionsPageType.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Enums/BlocksType.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterAcfOptionsPage.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterBlocks.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterCustomPostType.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterCustomTaxonomy.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Traits/PageBlocks.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{src/scripts/blog.js → custom/app/Ajax/.gitkeep} +0 -0
|
@@ -4,9 +4,7 @@ namespace Chisel\WP;
|
|
|
4
4
|
|
|
5
5
|
use Timber\Timber;
|
|
6
6
|
|
|
7
|
-
use Chisel\
|
|
8
|
-
use Chisel\Interfaces\HooksInterface;
|
|
9
|
-
use Chisel\Traits\Singleton;
|
|
7
|
+
use Chisel\Traits\HooksSingleton;
|
|
10
8
|
use Chisel\Helpers\CommentsHelpers;
|
|
11
9
|
use Chisel\Helpers\DataHelpers;
|
|
12
10
|
use Chisel\Helpers\ImageHelpers;
|
|
@@ -20,24 +18,9 @@ use Chisel\WP\Components;
|
|
|
20
18
|
*
|
|
21
19
|
* @package Chisel
|
|
22
20
|
*/
|
|
23
|
-
final class Twig
|
|
21
|
+
final class Twig {
|
|
24
22
|
|
|
25
|
-
use
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Class constructor.
|
|
29
|
-
*/
|
|
30
|
-
private function __construct() {
|
|
31
|
-
add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
|
|
32
|
-
|
|
33
|
-
$this->action_hooks();
|
|
34
|
-
$this->filter_hooks();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Set properties.
|
|
39
|
-
*/
|
|
40
|
-
public function set_properties(): void {}
|
|
23
|
+
use HooksSingleton;
|
|
41
24
|
|
|
42
25
|
/**
|
|
43
26
|
* Register action hooks.
|
|
@@ -83,6 +66,8 @@ final class Twig implements InstanceInterface, HooksInterface {
|
|
|
83
66
|
$this->register_function( $twig, 'get_icon', array( $this, 'get_icon' ) );
|
|
84
67
|
$this->register_function( $twig, 'should_use_icons_module', array( $this, 'should_use_icons_module' ) );
|
|
85
68
|
|
|
69
|
+
do_action( 'chisel_twig_register_functions', $twig, $this );
|
|
70
|
+
|
|
86
71
|
return $twig;
|
|
87
72
|
}
|
|
88
73
|
|
|
@@ -93,6 +78,7 @@ final class Twig implements InstanceInterface, HooksInterface {
|
|
|
93
78
|
* @return \Twig\Environment
|
|
94
79
|
*/
|
|
95
80
|
public function register_filters( \Twig\Environment $twig ): \Twig\Environment {
|
|
81
|
+
do_action( 'chisel_twig_register_filters', $twig, $this );
|
|
96
82
|
|
|
97
83
|
return $twig;
|
|
98
84
|
}
|
|
@@ -104,6 +90,7 @@ final class Twig implements InstanceInterface, HooksInterface {
|
|
|
104
90
|
* @return \Twig\Environment
|
|
105
91
|
*/
|
|
106
92
|
public function register_tests( \Twig\Environment $twig ): \Twig\Environment {
|
|
93
|
+
do_action( 'chisel_twig_register_tests', $twig, $this );
|
|
107
94
|
|
|
108
95
|
return $twig;
|
|
109
96
|
}
|
|
@@ -117,7 +104,7 @@ final class Twig implements InstanceInterface, HooksInterface {
|
|
|
117
104
|
*
|
|
118
105
|
* @return \Twig\Environment
|
|
119
106
|
*/
|
|
120
|
-
|
|
107
|
+
public function register_function( \Twig\Environment $twig, string $name, callable $callback ): \Twig\Environment {
|
|
121
108
|
$twig->addFunction( new \Twig\TwigFunction( $name, $callback ) );
|
|
122
109
|
|
|
123
110
|
return $twig;
|
|
@@ -132,7 +119,7 @@ final class Twig implements InstanceInterface, HooksInterface {
|
|
|
132
119
|
*
|
|
133
120
|
* @return \Twig\Environment
|
|
134
121
|
*/
|
|
135
|
-
|
|
122
|
+
public function register_filter( \Twig\Environment $twig, string $name, callable $callback ): \Twig\Environment {
|
|
136
123
|
$twig->addFilter( new \Twig\TwigFilter( $name, $callback ) );
|
|
137
124
|
|
|
138
125
|
return $twig;
|
|
@@ -147,7 +134,7 @@ final class Twig implements InstanceInterface, HooksInterface {
|
|
|
147
134
|
*
|
|
148
135
|
* @return \Twig\Environment
|
|
149
136
|
*/
|
|
150
|
-
|
|
137
|
+
public function register_test( \Twig\Environment $twig, string $name, callable $callback ): \Twig\Environment {
|
|
151
138
|
$twig->addTest( new \Twig\TwigTest( $name, $callback ) );
|
|
152
139
|
|
|
153
140
|
return $twig;
|
|
@@ -182,20 +169,14 @@ final class Twig implements InstanceInterface, HooksInterface {
|
|
|
182
169
|
*
|
|
183
170
|
* @return string
|
|
184
171
|
*/
|
|
185
|
-
public function post_classes( ?string $classes, string $prefix = 'c-post
|
|
172
|
+
public function post_classes( ?string $classes, string $prefix = 'c-post' ): string {
|
|
186
173
|
if ( empty( $classes ) ) {
|
|
187
174
|
return '';
|
|
188
175
|
}
|
|
189
176
|
|
|
190
177
|
$classnames = explode( ' ', $classes );
|
|
191
|
-
$classnames = array_map(
|
|
192
|
-
function ( $classname ) use ( $prefix ) {
|
|
193
|
-
return $prefix . $classname;
|
|
194
|
-
},
|
|
195
|
-
$classnames
|
|
196
|
-
);
|
|
197
178
|
|
|
198
|
-
return
|
|
179
|
+
return ThemeHelpers::bem( $prefix, ...$classnames );
|
|
199
180
|
}
|
|
200
181
|
|
|
201
182
|
/**
|
package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/Timber/ChiselPost.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\Timber\Custom;
|
|
4
|
+
|
|
5
|
+
use Chisel\Timber\ChiselPost as CoreChiselPost;
|
|
6
|
+
use Timber\Timber;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Extend Timber Post class with custom functionality.
|
|
10
|
+
*
|
|
11
|
+
* @package Chisel
|
|
12
|
+
*/
|
|
13
|
+
class ChiselPost extends CoreChiselPost {
|
|
14
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\WP\Custom;
|
|
4
|
+
|
|
5
|
+
use Chisel\Traits\HooksSingleton;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ACF related functionality.
|
|
9
|
+
*
|
|
10
|
+
* @package Chisel
|
|
11
|
+
*/
|
|
12
|
+
class Acf {
|
|
13
|
+
|
|
14
|
+
use HooksSingleton;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Register action hooks.
|
|
18
|
+
*/
|
|
19
|
+
public function action_hooks(): void {}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Register filter hooks.
|
|
23
|
+
*/
|
|
24
|
+
public function filter_hooks(): void {
|
|
25
|
+
add_filter( 'chisel_acf_options_pages', array( $this, 'register_acf_options_pages' ) );
|
|
26
|
+
add_filter( 'chisel_acf_options_sub_pages', array( $this, 'register_acf_options_sub_pages' ) );
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Register custom ACF options pages.
|
|
31
|
+
*
|
|
32
|
+
* @param array $options_pages The options pages.
|
|
33
|
+
*
|
|
34
|
+
* @return array
|
|
35
|
+
*/
|
|
36
|
+
public function register_acf_options_pages( $options_pages ) {
|
|
37
|
+
// phpcs:disable -- Example of custom ACF options page
|
|
38
|
+
// $options_pages[] = array(
|
|
39
|
+
// 'menu_slug' => 'theme-settings',
|
|
40
|
+
// 'page_title' => __( 'Theme Settings', 'chisel' ),
|
|
41
|
+
// );
|
|
42
|
+
// phpcs:enable
|
|
43
|
+
|
|
44
|
+
return $options_pages;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Register custom ACF options sub pages.
|
|
49
|
+
*
|
|
50
|
+
* @param array $options_sub_pages The options sub pages.
|
|
51
|
+
*
|
|
52
|
+
* @return array
|
|
53
|
+
*/
|
|
54
|
+
public function register_acf_options_sub_pages( $options_sub_pages ) {
|
|
55
|
+
// phpcs:disable -- Example of custom ACF options sub page
|
|
56
|
+
// $options_sub_pages[] = array(
|
|
57
|
+
// 'menu_slug' => 'theme-sub-settings',
|
|
58
|
+
// 'page_title' => __( 'Theme Sub settings', 'chisel' ),
|
|
59
|
+
// 'menu_title' => __( 'Theme Sub settings', 'chisel' ),
|
|
60
|
+
// 'parent_slug' => 'theme-settings',
|
|
61
|
+
// );
|
|
62
|
+
// phpcs:enable
|
|
63
|
+
|
|
64
|
+
return $options_sub_pages;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\WP\Custom;
|
|
4
|
+
|
|
5
|
+
use Chisel\Traits\HooksSingleton;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Ajax related functionality.
|
|
9
|
+
*
|
|
10
|
+
* @package Chisel
|
|
11
|
+
*/
|
|
12
|
+
class Ajax {
|
|
13
|
+
|
|
14
|
+
use HooksSingleton;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Register action hooks.
|
|
18
|
+
*/
|
|
19
|
+
public function action_hooks(): void {}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Register filter hooks.
|
|
23
|
+
*/
|
|
24
|
+
public function filter_hooks(): void {
|
|
25
|
+
add_filter( 'chisel_ajax_routes', array( $this, 'register_ajax_routes' ) );
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Register custom ajax routes.
|
|
30
|
+
*
|
|
31
|
+
* @param array $routes The ajax routes.
|
|
32
|
+
*
|
|
33
|
+
* @return array
|
|
34
|
+
*/
|
|
35
|
+
public function register_ajax_routes( array $routes ): array {
|
|
36
|
+
// phpcs:disable -- Example of custom ajax route
|
|
37
|
+
// $routes['custom_route'] = array(
|
|
38
|
+
// 'methods' => 'POST', // default is POST
|
|
39
|
+
// 'handler' => 'Chisel\WP\Custom\Ajax\CustomRouteHandler', // custom handler class, leave empty for default handler: CustomRouteEndpoint
|
|
40
|
+
// );
|
|
41
|
+
// phpcs:enable
|
|
42
|
+
|
|
43
|
+
return $routes;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\WP\Custom;
|
|
4
|
+
|
|
5
|
+
use Chisel\Traits\HooksSingleton;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Class for enqueuing scripts and styles.
|
|
9
|
+
*
|
|
10
|
+
* @package Chisel
|
|
11
|
+
*/
|
|
12
|
+
class Assets {
|
|
13
|
+
use HooksSingleton;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Add action hooks.
|
|
17
|
+
*/
|
|
18
|
+
public function action_hooks(): void {}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Add filter hooks.
|
|
22
|
+
*/
|
|
23
|
+
public function filter_hooks(): void {
|
|
24
|
+
add_filter( 'chisel_frontend_styles', array( $this, 'frontend_styles' ) );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Modify frontend styles.
|
|
29
|
+
*
|
|
30
|
+
* @param array $styles Frontend styles.
|
|
31
|
+
*
|
|
32
|
+
* @return array Frontend styles.
|
|
33
|
+
*/
|
|
34
|
+
public function frontend_styles( array $styles ): array {
|
|
35
|
+
return $styles;
|
|
36
|
+
}
|
|
37
|
+
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/CustomPostTypes.php
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\WP\Custom;
|
|
4
|
+
|
|
5
|
+
use Chisel\Traits\HooksSingleton;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Custom Post Types related functionality.
|
|
9
|
+
*
|
|
10
|
+
* @package Chisel
|
|
11
|
+
*/
|
|
12
|
+
class CustomPostTypes {
|
|
13
|
+
use HooksSingleton;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Register action hooks.
|
|
17
|
+
*/
|
|
18
|
+
public function action_hooks(): void {}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Register filter hooks.
|
|
22
|
+
*/
|
|
23
|
+
public function filter_hooks(): void {
|
|
24
|
+
add_filter( 'chisel_custom_post_types', array( $this, 'register_custom_post_types' ) );
|
|
25
|
+
add_filter( 'chisel_custom_taxonomies', array( $this, 'register_custom_taxonomies' ) );
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Register custom post types.
|
|
30
|
+
*
|
|
31
|
+
* @param array $post_types The post types.
|
|
32
|
+
*
|
|
33
|
+
* @return array
|
|
34
|
+
*/
|
|
35
|
+
public function register_custom_post_types( $post_types ) {
|
|
36
|
+
// phpcs:disable -- Example of custom post type. Remove this line and the phpcs:enable when adding your own custom post types
|
|
37
|
+
// $post_types['chisel-cpt'] = array(
|
|
38
|
+
// 'singular' => __( 'Chisel CPT', 'chisel' ),
|
|
39
|
+
// 'plural' => __( 'Chisel CPTs', 'chisel' ),
|
|
40
|
+
// 'supports' => array( 'editor', 'thumbnail', 'excerpt' ),
|
|
41
|
+
// 'menu_icon' => 'dashicons-location-alt',
|
|
42
|
+
// 'hierarchical' => true,
|
|
43
|
+
// 'public' => true,
|
|
44
|
+
// 'menu_position' => 20,
|
|
45
|
+
// 'rewrite' => array(
|
|
46
|
+
// 'slug' => 'chisel-post',
|
|
47
|
+
// ),
|
|
48
|
+
// );
|
|
49
|
+
// phpcs:enable
|
|
50
|
+
|
|
51
|
+
return $post_types;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Register custom taxonomies.
|
|
56
|
+
*
|
|
57
|
+
* @param array $taxonomies The taxonomies.
|
|
58
|
+
*
|
|
59
|
+
* @return array
|
|
60
|
+
*/
|
|
61
|
+
public function register_custom_taxonomies( $taxonomies ) {
|
|
62
|
+
// phpcs:disable -- Example of custom taxonomy. Remove this line and the phpcs:enable when adding your own custom taxonomies
|
|
63
|
+
// $taxonomies['chisel-term'] = array(
|
|
64
|
+
// 'singular' => __( 'Chisel Term', 'chisel' ),
|
|
65
|
+
// 'plural' => __( 'Chisel Terms', 'chisel' ),
|
|
66
|
+
// 'post_types' => array( 'chisel-cpt' ),
|
|
67
|
+
// 'public' => true,
|
|
68
|
+
// 'rewrite' => array(
|
|
69
|
+
// 'slug' => 'chisel-term',
|
|
70
|
+
// ),
|
|
71
|
+
// );
|
|
72
|
+
// phpcs:enable
|
|
73
|
+
|
|
74
|
+
return $taxonomies;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\WP\Custom;
|
|
4
|
+
|
|
5
|
+
use Chisel\Traits\HooksSingleton;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Site related functionality related to timber.
|
|
9
|
+
*
|
|
10
|
+
* @package Chisel
|
|
11
|
+
*/
|
|
12
|
+
class Site {
|
|
13
|
+
|
|
14
|
+
use HooksSingleton;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Register action hooks.
|
|
18
|
+
*/
|
|
19
|
+
public function action_hooks(): void {}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Register filter hooks.
|
|
23
|
+
*/
|
|
24
|
+
public function filter_hooks(): void {
|
|
25
|
+
add_filter( 'timber/post/classmap', array( $this, 'post_classmap' ), 11 );
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Add custom post class map.
|
|
30
|
+
*
|
|
31
|
+
* @param array $classmap The class map.
|
|
32
|
+
*
|
|
33
|
+
* @return array
|
|
34
|
+
*/
|
|
35
|
+
public function post_classmap( array $classmap ): array {
|
|
36
|
+
$custom_classmap = array(
|
|
37
|
+
'post' => \Chisel\Timber\Custom\ChiselPost::class,
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return array_merge( $classmap, $custom_classmap );
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel\WP\Custom;
|
|
4
|
+
|
|
5
|
+
use Chisel\Traits\HooksSingleton;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Custom Twig functionality.
|
|
9
|
+
*
|
|
10
|
+
* @package Chisel
|
|
11
|
+
*/
|
|
12
|
+
class Twig {
|
|
13
|
+
|
|
14
|
+
use HooksSingleton;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Register action hooks.
|
|
18
|
+
*/
|
|
19
|
+
public function action_hooks(): void {
|
|
20
|
+
add_action( 'chisel_twig_register_functions', array( $this, 'register_functions' ), 10, 2 );
|
|
21
|
+
add_action( 'chisel_twig_register_filters', array( $this, 'register_filters' ), 10, 2 );
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Register filter hooks.
|
|
26
|
+
*/
|
|
27
|
+
public function filter_hooks(): void {}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Register custom twig functions.
|
|
31
|
+
*
|
|
32
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
33
|
+
* @param \Chisel\WP\Twig $chisel_twig The Chisel Twig instance.
|
|
34
|
+
*/
|
|
35
|
+
public function register_functions( \Twig\Environment $twig, \Chisel\WP\Twig $chisel_twig ): void {
|
|
36
|
+
// phpcs:disable -- Example of custom function. Remove this line and the phpcs:enable when adding your own custom functions
|
|
37
|
+
// $twig->addFunction( new \Twig\Function( 'custom_fn', array( $this, 'custom_fn_callback' ) ) );
|
|
38
|
+
// phpcs:enable
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Register custom twig filters.
|
|
43
|
+
*
|
|
44
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
45
|
+
* @param \Chisel\WP\Twig $chisel_twig The Chisel Twig instance.
|
|
46
|
+
*/
|
|
47
|
+
public function register_filters( \Twig\Environment $twig, \Chisel\WP\Twig $chisel_twig ): void {
|
|
48
|
+
// phpcs:disable -- Example of custom filter. Remove this line and the phpcs:enable when adding your own custom filters
|
|
49
|
+
// $twig->addFilter( new \Twig\Filter( 'custom_filter', array( $this, 'custom_filter_callback' ) ) );
|
|
50
|
+
// phpcs:enable
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
\Chisel\WP\Custom\Acf::get_instance();
|
|
4
|
+
\Chisel\WP\Custom\Ajax::get_instance();
|
|
5
|
+
\Chisel\WP\Custom\Assets::get_instance();
|
|
6
|
+
\Chisel\WP\Custom\CustomPostTypes::get_instance();
|
|
7
|
+
\Chisel\WP\Custom\Site::get_instance();
|
|
8
|
+
\Chisel\WP\Custom\Twig::get_instance();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Custom views
|
|
2
|
+
|
|
3
|
+
Recommended approach is to use the main views folder, but if want more control and clear separation between the main theme and customizations, use the custom views folder.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
To overwrite views existing in the main folder create a file with the same name and the same folder structure.
|
|
@@ -6,27 +6,38 @@ require_once get_template_directory() . '/vendor/autoload.php';
|
|
|
6
6
|
|
|
7
7
|
spl_autoload_register(
|
|
8
8
|
function ( $class_name ) {
|
|
9
|
-
$
|
|
9
|
+
$base_directories = array(
|
|
10
|
+
get_template_directory() . '/core/',
|
|
11
|
+
get_template_directory() . '/custom/app/',
|
|
12
|
+
);
|
|
10
13
|
|
|
11
14
|
$namespace_prefix_length = strlen( CHISEL_NAMESPACE );
|
|
12
15
|
|
|
13
16
|
if ( strncmp( CHISEL_NAMESPACE, $class_name, $namespace_prefix_length ) !== 0 ) {
|
|
14
|
-
|
|
17
|
+
return;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
$relative_class_name = substr( $class_name, $namespace_prefix_length );
|
|
21
|
+
$relative_path = str_replace( '\\', '/', $relative_class_name ) . '.php';
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
foreach ( $base_directories as $base_directory ) {
|
|
24
|
+
if ( strpos( $base_directory, 'custom/app' ) !== false ) {
|
|
25
|
+
$relative_path = preg_replace( '/\/Custom\//', '/', $relative_path, 1 );
|
|
26
|
+
}
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
$class_filename = $base_directory . $relative_path;
|
|
29
|
+
|
|
30
|
+
if ( file_exists( $class_filename ) ) {
|
|
31
|
+
require $class_filename;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
23
34
|
}
|
|
24
35
|
}
|
|
25
36
|
);
|
|
26
37
|
|
|
27
38
|
// Icons module. Also requires packacke.json and scss configuration.
|
|
28
39
|
if ( ! defined( 'CHISEL_USE_ICONS_MODULE' ) ) {
|
|
29
|
-
define( 'CHISEL_USE_ICONS_MODULE',
|
|
40
|
+
define( 'CHISEL_USE_ICONS_MODULE', false );
|
|
30
41
|
}
|
|
31
42
|
|
|
32
43
|
Timber\Timber::init();
|
|
@@ -36,7 +47,6 @@ Timber\Timber::init();
|
|
|
36
47
|
\Chisel\WP\Acf::get_instance();
|
|
37
48
|
\Chisel\WP\AcfBlocks::get_instance();
|
|
38
49
|
\Chisel\WP\Assets::get_instance();
|
|
39
|
-
\Chisel\WP\Cache::get_instance();
|
|
40
50
|
\Chisel\WP\Comments::get_instance();
|
|
41
51
|
\Chisel\WP\Site::get_instance();
|
|
42
52
|
\Chisel\WP\Sidebars::get_instance();
|
|
@@ -44,6 +54,13 @@ Timber\Timber::init();
|
|
|
44
54
|
\Chisel\WP\CustomPostTypes::get_instance();
|
|
45
55
|
\Chisel\WP\CustomTaxonomies::get_instance();
|
|
46
56
|
\Chisel\WP\Twig::get_instance();
|
|
47
|
-
\Chisel\Plugins\GravityForms::get_instance();
|
|
48
|
-
\Chisel\Plugins\Woocommerce::get_instance();
|
|
49
|
-
\Chisel\Plugins\Yoast::get_instance();
|
|
57
|
+
\Chisel\Plugins\GravityForms\GravityForms::get_instance();
|
|
58
|
+
\Chisel\Plugins\Woocommerce\Woocommerce::get_instance();
|
|
59
|
+
\Chisel\Plugins\Yoast\Yoast::get_instance();
|
|
60
|
+
\Chisel\Timber\Cache::get_instance();
|
|
61
|
+
|
|
62
|
+
$custom_functions_php = get_template_directory() . '/custom/functions.php';
|
|
63
|
+
|
|
64
|
+
if ( is_file( $custom_functions_php ) ) {
|
|
65
|
+
require_once $custom_functions_php;
|
|
66
|
+
}
|
|
@@ -14,15 +14,19 @@
|
|
|
14
14
|
"start": "chisel-scripts start --experimental-modules",
|
|
15
15
|
"dev": "npm run --silent start",
|
|
16
16
|
"build-scripts": "chisel-scripts build --experimental-modules",
|
|
17
|
-
"build": "npm run build-scripts && npm run lint && npm run phpcs && npm run twigcs",
|
|
17
|
+
"build": "npm run build-scripts && npm run lint && npm run phpcs && npm run twigcs && npm run check-update",
|
|
18
18
|
"add-page": "chisel-scripts add-page",
|
|
19
19
|
"create-block": "chisel-scripts create-block --category=chisel-blocks --namespace=chisel",
|
|
20
20
|
"create-dynamic-block": "npm run create-block --variant=dynamic",
|
|
21
21
|
"wp": "chisel-scripts wp",
|
|
22
22
|
"composer": "chisel-scripts composer",
|
|
23
23
|
"wp-config": "chisel-scripts wp-config",
|
|
24
|
-
"phpcs": "cross-env vendor/bin/phpcs --extensions=php",
|
|
25
|
-
"twigcs": "cross-env vendor/bin/twigcs --config=twig_cs.php"
|
|
24
|
+
"phpcs": "cross-env vendor/bin/phpcs --extensions=php --exclude=Generic.PHP.Syntax",
|
|
25
|
+
"twigcs": "cross-env vendor/bin/twigcs --config=twig_cs.php",
|
|
26
|
+
"check-update": "chisel-scripts check-chisel-update",
|
|
27
|
+
"update-chisel": "chisel-scripts chisel-update",
|
|
28
|
+
"update": "npm run check-update && npm run update-chisel",
|
|
29
|
+
"prepare": "chisel-scripts husky-init || node -e \"\""
|
|
26
30
|
},
|
|
27
31
|
"dependencies": {
|
|
28
32
|
"swiper": "^11.1.10",
|
|
@@ -31,7 +35,8 @@
|
|
|
31
35
|
"devDependencies": {
|
|
32
36
|
"@wordpress/scripts": "^31.2.0",
|
|
33
37
|
"chisel-scripts": "*",
|
|
34
|
-
"cross-env": "^7.0.3"
|
|
38
|
+
"cross-env": "^7.0.3",
|
|
39
|
+
"husky": "^9.1.7"
|
|
35
40
|
},
|
|
36
41
|
"overrides": {
|
|
37
42
|
"@wordpress/scripts": {
|
|
@@ -63,4 +63,14 @@
|
|
|
63
63
|
<severity>0</severity>
|
|
64
64
|
</rule>
|
|
65
65
|
|
|
66
|
+
<!-- Disable unused function parameter warning - WordPress hooks often require specific signatures -->
|
|
67
|
+
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
|
|
68
|
+
<severity>0</severity>
|
|
69
|
+
</rule>
|
|
70
|
+
|
|
71
|
+
<!-- Disable Generic.PHP.Syntax - causes internal errors with PHP 8.2+ due to null to trim() deprecation -->
|
|
72
|
+
<rule ref="Generic.PHP.Syntax">
|
|
73
|
+
<severity>0</severity>
|
|
74
|
+
</rule>
|
|
75
|
+
|
|
66
76
|
</ruleset>
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core.js
CHANGED
|
@@ -5,7 +5,11 @@ import { InspectorControls } from '@wordpress/blockEditor';
|
|
|
5
5
|
import { PanelBody, ToggleControl } from '@wordpress/components';
|
|
6
6
|
import { Fragment } from '@wordpress/element';
|
|
7
7
|
|
|
8
|
-
addFilter('blocks.registerBlockType', 'chisel/add-no-margin-attribute', (settings) => {
|
|
8
|
+
addFilter('blocks.registerBlockType', 'chisel/add-no-margin-attribute', (settings, name) => {
|
|
9
|
+
if (!name.includes('core/') && !name.includes('chisel/')) {
|
|
10
|
+
return settings;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
if (typeof settings.attributes !== 'undefined') {
|
|
10
14
|
settings.attributes = {
|
|
11
15
|
...settings.attributes,
|
|
@@ -20,7 +24,12 @@ addFilter('blocks.registerBlockType', 'chisel/add-no-margin-attribute', (setting
|
|
|
20
24
|
|
|
21
25
|
const addNoMarginToggle = createHigherOrderComponent((BlockEdit) => {
|
|
22
26
|
return (props) => {
|
|
23
|
-
const { attributes, setAttributes, isSelected } = props;
|
|
27
|
+
const { attributes, setAttributes, isSelected, name } = props;
|
|
28
|
+
|
|
29
|
+
if (!name.includes('core/') && !name.includes('chisel/')) {
|
|
30
|
+
return <BlockEdit {...props} />;
|
|
31
|
+
}
|
|
32
|
+
|
|
24
33
|
const { disableBottomMargin = false, className = '' } = attributes;
|
|
25
34
|
|
|
26
35
|
const onToggle = (checked) => {
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/main-nav.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
class MainNav {
|
|
2
|
+
/**
|
|
3
|
+
* Delay before adding the 'open' class after 'active'.
|
|
4
|
+
* This small delay ensures CSS transitions trigger properly.
|
|
5
|
+
*/
|
|
6
|
+
static ANIMATION_START_DELAY = 10;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Duration to wait before cleanup after closing.
|
|
10
|
+
* Should match the CSS transition duration for the nav items.
|
|
11
|
+
*/
|
|
12
|
+
static TRANSITION_DURATION = 300;
|
|
13
|
+
|
|
2
14
|
constructor() {
|
|
3
15
|
this.initSelectors();
|
|
4
16
|
this.initElements();
|
|
@@ -71,7 +83,7 @@ class MainNav {
|
|
|
71
83
|
|
|
72
84
|
setTimeout(() => {
|
|
73
85
|
this.elements.navItems.classList.add(this.classnames.open);
|
|
74
|
-
},
|
|
86
|
+
}, MainNav.ANIMATION_START_DELAY);
|
|
75
87
|
|
|
76
88
|
const coords = this.elements.navToggle.getBoundingClientRect();
|
|
77
89
|
|
|
@@ -91,7 +103,7 @@ class MainNav {
|
|
|
91
103
|
right: 'auto',
|
|
92
104
|
position: 'relative',
|
|
93
105
|
});
|
|
94
|
-
},
|
|
106
|
+
}, MainNav.TRANSITION_DURATION);
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
}
|