generator-chisel 2.0.0-alpha.5 → 2.0.0-alpha.6
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 +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/archive.php +1 -12
- package/lib/commands/create/creators/app/chisel-starter-theme/author.php +2 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/AcfBlocks.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Assets.php +86 -45
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Blocks.php +16 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Components.php +56 -19
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/CustomPostTypes.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedPost.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedProduct.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/GravityForms.php +47 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Helpers.php +67 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/RegisterBlocks.php +2 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Site.php +1 -18
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Theme.php +1 -20
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Twig.php +57 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Yoast.php +17 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/index.php +0 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/search.php +0 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/acf-json/group_66462c70b851f.json +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/block.json +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/slider.twig +2 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_icon.scss +8 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_media.scss +15 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/app.js +2 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-mods.js +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/blocks-alignment.js +26 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-button.js +60 -5
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/scrollbar-width.js +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/slider.js +6 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss +21 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +21 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_slider.scss +13 -7
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/vendor/_breadcrumbs.scss +16 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_swiper-sliders.scss +11 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/404.twig +1 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/base.twig +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +2 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/block-edit-button.twig +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/the-title.twig +3 -1
- package/lib/commands/create/packages-versions.js +2 -2
- package/package.json +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/page-title.twig +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- INSERT-NEW-ENTRIES-HERE -->
|
|
4
4
|
|
|
5
|
+
## 2.0.0-alpha.6 (2024-10-07)
|
|
6
|
+
|
|
7
|
+
- blocks, assets, css adjustments, breadcrumbs, bem fn ([b3460ce](https://github.com/xfiveco/generator-chisel/commit/b3460ce))
|
|
8
|
+
- page title, gravity forms, responsive image, slider fixes ([619789e](https://github.com/xfiveco/generator-chisel/commit/619789e))
|
|
9
|
+
|
|
5
10
|
## 2.0.0-alpha.5 (2024-09-27)
|
|
6
11
|
|
|
7
12
|
- bugs fixes, blocks mods, adjustments ([5a2b460](https://github.com/xfiveco/generator-chisel/commit/5a2b460))
|
|
@@ -12,24 +12,13 @@ $templates = array( 'archive.twig', 'index.twig' );
|
|
|
12
12
|
|
|
13
13
|
$context = Timber::context();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
if ( is_day() ) {
|
|
17
|
-
$context['title'] = 'Archive: ' . get_the_date( 'D M Y' );
|
|
18
|
-
} elseif ( is_month() ) {
|
|
19
|
-
$context['title'] = 'Archive: ' . get_the_date( 'M Y' );
|
|
20
|
-
} elseif ( is_year() ) {
|
|
21
|
-
$context['title'] = 'Archive: ' . get_the_date( 'Y' );
|
|
22
|
-
} elseif ( is_tag() ) {
|
|
23
|
-
$context['title'] = __( 'Tag: ', 'chisel' ) . ' ' . single_tag_title( '', false );
|
|
15
|
+
if ( is_tag() ) {
|
|
24
16
|
array_unshift( $templates, 'archive-' . get_queried_object()->slug . '.twig' );
|
|
25
17
|
} elseif ( is_category() ) {
|
|
26
|
-
$context['title'] = __( 'Category: ', 'chisel' ) . ' ' . single_cat_title( '', false );
|
|
27
18
|
array_unshift( $templates, 'archive-' . get_queried_object()->slug . '.twig' );
|
|
28
19
|
} elseif ( is_post_type_archive() ) {
|
|
29
|
-
$context['title'] = post_type_archive_title( '', false );
|
|
30
20
|
array_unshift( $templates, 'archive-' . get_post_type() . '.twig' );
|
|
31
21
|
} elseif ( is_tax() ) {
|
|
32
|
-
$context['title'] = single_term_title( '', false );
|
|
33
22
|
array_unshift( $templates, 'archive-' . get_queried_object()->taxonomy . '.twig' );
|
|
34
23
|
}
|
|
35
24
|
|
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
use Chisel\ChiselCache;
|
|
9
9
|
use Timber\Timber;
|
|
10
10
|
|
|
11
|
-
$
|
|
12
|
-
|
|
13
|
-
$context = Timber::context();
|
|
14
|
-
$context['posts'] = Timber::get_posts();
|
|
15
|
-
$context['author'] = $author;
|
|
16
|
-
$context['title'] = __( 'Author: ', 'chisel' ) . $author->name;
|
|
11
|
+
$context = Timber::context();
|
|
12
|
+
$context['posts'] = Timber::get_posts();
|
|
17
13
|
|
|
18
14
|
Timber::render( array( 'author.twig', 'archive.twig' ), $context, ChiselCache::expiry() );
|
|
@@ -162,7 +162,7 @@ class AcfBlocks extends RegisterBlocks implements Instance {
|
|
|
162
162
|
|
|
163
163
|
// allow to use filters to manipulate the output.
|
|
164
164
|
$context = apply_filters( 'chisel_timber_acf_blocks_data', $context );
|
|
165
|
-
$context = apply_filters( 'chisel_timber_acf_blocks_data_' . $
|
|
165
|
+
$context = apply_filters( 'chisel_timber_acf_blocks_data_' . $block_slug, $context );
|
|
166
166
|
$context = apply_filters( 'chisel_timber_acf_blocks_data_' . $block['id'], $context );
|
|
167
167
|
|
|
168
168
|
$context['wrapper_attributes'] = get_block_wrapper_attributes(
|
|
@@ -16,6 +16,13 @@ class Assets implements Instance {
|
|
|
16
16
|
*/
|
|
17
17
|
protected $frontend_styles = array();
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Front-end styles to be registered and enqueued in footer.
|
|
21
|
+
*
|
|
22
|
+
* @var array
|
|
23
|
+
*/
|
|
24
|
+
protected $frontend_footer_styles = array();
|
|
25
|
+
|
|
19
26
|
/**
|
|
20
27
|
* Front-end scripts to be registered and enqueued.
|
|
21
28
|
*
|
|
@@ -177,6 +184,7 @@ class Assets implements Instance {
|
|
|
177
184
|
add_action( 'init', array( $this, 'register_assets' ) );
|
|
178
185
|
|
|
179
186
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend_assets' ), 99 ); // Higher priority, overwrite plugins if needed.
|
|
187
|
+
add_action( 'wp_footer', array( $this, 'enqueue_frontend_assets_in_footer' ), 11 ); // Higher priority, overwrite plugins if needed.
|
|
180
188
|
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ), 11 );
|
|
181
189
|
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_editor_scripts' ) );
|
|
182
190
|
add_action( 'login_enqueue_scripts', array( $this, 'enqueue_login_page_assets' ), 99 );
|
|
@@ -195,66 +203,78 @@ class Assets implements Instance {
|
|
|
195
203
|
* Register assets.
|
|
196
204
|
*/
|
|
197
205
|
public function register_assets() {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
if ( ! is_admin() ) {
|
|
207
|
+
$this->frontend_styles = apply_filters( 'chisel_frontend_styles', $this->frontend_styles );
|
|
208
|
+
$this->frontend_footer_styles = apply_filters( 'chisel_frontend_footer_styles', $this->frontend_footer_styles );
|
|
209
|
+
$this->frontend_scripts = apply_filters( 'chisel_frontend_scripts', $this->frontend_scripts );
|
|
210
|
+
$this->login_styles = apply_filters( 'chisel_login_styles', $this->login_styles );
|
|
211
|
+
$this->login_scripts = apply_filters( 'chisel_login_scripts', $this->login_scripts );
|
|
212
|
+
|
|
213
|
+
if ( $this->frontend_styles ) {
|
|
214
|
+
foreach ( $this->frontend_styles as $file_name => $args ) {
|
|
215
|
+
$this->register_style( self::get_final_handle( $file_name ), $file_name, $args );
|
|
216
|
+
}
|
|
217
|
+
}
|
|
206
218
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
219
|
+
if ( $this->frontend_footer_styles ) {
|
|
220
|
+
foreach ( $this->frontend_footer_styles as $file_name => $args ) {
|
|
221
|
+
$this->register_style( self::get_final_handle( $file_name ), $file_name, $args );
|
|
222
|
+
}
|
|
210
223
|
}
|
|
211
|
-
}
|
|
212
224
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
225
|
+
if ( $this->frontend_scripts ) {
|
|
226
|
+
foreach ( $this->frontend_scripts as $file_name => $args ) {
|
|
227
|
+
$this->register_script( self::get_final_handle( $file_name ), $file_name, $args );
|
|
228
|
+
}
|
|
216
229
|
}
|
|
217
|
-
}
|
|
218
230
|
|
|
219
|
-
|
|
220
|
-
|
|
231
|
+
if ( is_login() ) {
|
|
232
|
+
if ( $this->login_styles ) {
|
|
233
|
+
$login_styles_data = array();
|
|
221
234
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
235
|
+
foreach ( $this->login_styles as $file_name => $args ) {
|
|
236
|
+
$login_styles_data = $this->register_style( self::get_final_handle( $file_name ), $file_name, $args );
|
|
237
|
+
}
|
|
225
238
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
239
|
+
if ( isset( $login_styles_data['ver'] ) ) {
|
|
240
|
+
wp_register_style( 'global-styles', false, array(), $login_styles_data['ver'] );
|
|
241
|
+
}
|
|
242
|
+
}
|
|
230
243
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
244
|
+
if ( $this->login_scripts ) {
|
|
245
|
+
foreach ( $this->login_scripts as $file_name => $args ) {
|
|
246
|
+
$this->register_script( self::get_final_handle( $file_name ), $file_name, $args );
|
|
247
|
+
}
|
|
248
|
+
}
|
|
234
249
|
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
250
|
+
} else {
|
|
251
|
+
$this->admin_styles = apply_filters( 'chisel_admin_styles', $this->admin_styles );
|
|
252
|
+
$this->admin_scripts = apply_filters( 'chisel_admin_scripts', $this->admin_scripts );
|
|
253
|
+
$this->editor_styles = apply_filters( 'chisel_editor_styles', $this->editor_styles );
|
|
254
|
+
$this->editor_scripts = apply_filters( 'chisel_editor_scripts', $this->editor_scripts );
|
|
255
|
+
|
|
256
|
+
if ( $this->admin_styles ) {
|
|
257
|
+
foreach ( $this->admin_styles as $file_name => $args ) {
|
|
258
|
+
$this->register_style( self::get_final_handle( $file_name ), $file_name, $args );
|
|
259
|
+
}
|
|
240
260
|
}
|
|
241
|
-
}
|
|
242
261
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
262
|
+
if ( $this->admin_scripts ) {
|
|
263
|
+
foreach ( $this->admin_scripts as $file_name => $args ) {
|
|
264
|
+
$this->register_script( self::get_final_handle( $file_name ), $file_name, $args );
|
|
265
|
+
}
|
|
246
266
|
}
|
|
247
|
-
}
|
|
248
267
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
268
|
+
if ( $this->editor_styles ) {
|
|
269
|
+
foreach ( $this->editor_styles as $file_name => $args ) {
|
|
270
|
+
$this->register_style( self::get_final_handle( $file_name ), $file_name, $args );
|
|
271
|
+
}
|
|
252
272
|
}
|
|
253
|
-
}
|
|
254
273
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
274
|
+
if ( $this->editor_scripts ) {
|
|
275
|
+
foreach ( $this->editor_scripts as $file_name => $args ) {
|
|
276
|
+
$this->register_script( self::get_final_handle( $file_name ), $file_name, $args );
|
|
277
|
+
}
|
|
258
278
|
}
|
|
259
279
|
}
|
|
260
280
|
}
|
|
@@ -293,6 +313,27 @@ class Assets implements Instance {
|
|
|
293
313
|
}
|
|
294
314
|
}
|
|
295
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Enqueue front-end styles in footer, ie. Gravity Forms custom styles.
|
|
318
|
+
*/
|
|
319
|
+
public function enqueue_frontend_assets_in_footer() {
|
|
320
|
+
$this->frontend_footer_styles = apply_filters( 'chisel_pre_enqueue_frontend_footer_styles', $this->frontend_footer_styles );
|
|
321
|
+
|
|
322
|
+
if ( $this->frontend_footer_styles ) {
|
|
323
|
+
foreach ( $this->frontend_footer_styles as $handle => $args ) {
|
|
324
|
+
$enqueue_style = apply_filters( 'chisel_enqueue_frontend_footer_style', true, $handle, $args );
|
|
325
|
+
$style_handle = self::get_final_handle( $handle );
|
|
326
|
+
|
|
327
|
+
if ( $enqueue_style && wp_style_is( $style_handle, 'registered' ) ) {
|
|
328
|
+
wp_enqueue_style( $style_handle );
|
|
329
|
+
|
|
330
|
+
// Enqueue js file for fast refresh of the css file.
|
|
331
|
+
$this->enqueue_style_js_for_dev( $handle );
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
296
337
|
/**
|
|
297
338
|
* Enqueue admin assets.
|
|
298
339
|
*/
|
|
@@ -77,6 +77,7 @@ class Blocks extends RegisterBlocks implements Instance {
|
|
|
77
77
|
|
|
78
78
|
add_filter( 'should_load_separate_core_block_assets', array( $this, 'should_load_separate_core_block_assets' ) );
|
|
79
79
|
add_filter( 'styles_inline_size_limit', array( $this, 'styles_inline_size_limit' ) );
|
|
80
|
+
add_filter( 'chisel_editor_scripts', array( $this, 'blocks_alignment_data' ) );
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
/**
|
|
@@ -215,6 +216,21 @@ class Blocks extends RegisterBlocks implements Instance {
|
|
|
215
216
|
return $load;
|
|
216
217
|
}
|
|
217
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Set default alignment for blocks.
|
|
221
|
+
*
|
|
222
|
+
* @param array $editor_scripts_data
|
|
223
|
+
*
|
|
224
|
+
* @return array
|
|
225
|
+
*/
|
|
226
|
+
public function blocks_alignment_data( $editor_scripts_data ) {
|
|
227
|
+
$editor_scripts_data['editor']['localize']['data']['blocksDefaultAlignment'] = array(
|
|
228
|
+
'chisel/slider' => 'full',
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
return $editor_scripts_data;
|
|
232
|
+
}
|
|
233
|
+
|
|
218
234
|
/**
|
|
219
235
|
* Get block object classnames
|
|
220
236
|
*
|
|
@@ -86,7 +86,7 @@ class Components {
|
|
|
86
86
|
$logo_id = get_theme_mod( 'custom_logo', 0 );
|
|
87
87
|
|
|
88
88
|
if ( $logo_id ) {
|
|
89
|
-
self::$logo_image =
|
|
89
|
+
self::$logo_image = Helpers::get_responsive_image( $logo_id );
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
$context['logo_image'] = self::$logo_image;
|
|
@@ -172,36 +172,73 @@ class Components {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
|
-
* Get the page
|
|
176
|
-
*
|
|
177
|
-
* @param int $post_id
|
|
175
|
+
* Get the current page title.
|
|
178
176
|
*
|
|
179
177
|
* @return string|html
|
|
180
178
|
*/
|
|
181
|
-
public static function get_the_title(
|
|
182
|
-
$
|
|
179
|
+
public static function get_the_title() {
|
|
180
|
+
$classname = 'c-title';
|
|
181
|
+
$the_title = array();
|
|
182
|
+
$title_text = '';
|
|
183
|
+
$title_class = '';
|
|
184
|
+
|
|
185
|
+
if ( self::$the_title !== null ) {
|
|
186
|
+
return self::$the_title;
|
|
187
|
+
}
|
|
183
188
|
|
|
184
|
-
if (
|
|
185
|
-
|
|
189
|
+
if ( is_singular() ) {
|
|
190
|
+
global $post;
|
|
186
191
|
|
|
187
|
-
if ( $
|
|
188
|
-
|
|
189
|
-
} else {
|
|
190
|
-
$title = get_the_title( $post_id );
|
|
191
|
-
$sr_only = $display === 'hide-visually' ? 'u-sr-only' : '';
|
|
192
|
+
if ( isset( $post->ID ) ) {
|
|
193
|
+
$display_title = Acf::get_field( 'page_title_display', $post->ID ) ?: 'show';
|
|
192
194
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
'
|
|
196
|
-
|
|
195
|
+
if ( $display_title !== 'hide' ) {
|
|
196
|
+
$title_text = get_the_title( $post->ID );
|
|
197
|
+
$sr_only = $display_title === 'hide-visually' ? 'u-sr-only' : '';
|
|
198
|
+
$title_class = sprintf( '%s %s', $classname, $sr_only );
|
|
199
|
+
}
|
|
197
200
|
}
|
|
201
|
+
} elseif ( is_home() ) {
|
|
202
|
+
$posts_page_id = absint( get_option( 'page_for_posts' ) );
|
|
203
|
+
|
|
204
|
+
if ( $posts_page_id ) {
|
|
205
|
+
$title_text = get_the_title( $posts_page_id );
|
|
206
|
+
}
|
|
207
|
+
} elseif ( is_author() ) {
|
|
208
|
+
$author = Timber::get_user( get_queried_object_id() );
|
|
209
|
+
$title_text = __( 'Author: ', 'chisel' ) . $author->name;
|
|
210
|
+
} elseif ( is_day() ) {
|
|
211
|
+
$title_text = __( 'Date archive: ', 'chisel' ) . ' ' . get_the_date( 'D M Y' );
|
|
212
|
+
} elseif ( is_month() ) {
|
|
213
|
+
$title_text = __( 'Date archive: ', 'chisel' ) . ' ' . get_the_date( 'M Y' );
|
|
214
|
+
} elseif ( is_year() ) {
|
|
215
|
+
$title_text = __( 'Date archive: ', 'chisel' ) . ' ' . get_the_date( 'Y' );
|
|
216
|
+
} elseif ( is_tag() ) {
|
|
217
|
+
$title_text = __( 'Tag: ', 'chisel' ) . ' ' . single_tag_title( '', false );
|
|
218
|
+
} elseif ( is_category() ) {
|
|
219
|
+
$title_text = __( 'Category: ', 'chisel' ) . ' ' . single_cat_title( '', false );
|
|
220
|
+
} elseif ( is_post_type_archive() ) {
|
|
221
|
+
$title_text = post_type_archive_title( '', false );
|
|
222
|
+
} elseif ( is_tax() ) {
|
|
223
|
+
$title_text = single_term_title( '', false );
|
|
224
|
+
} elseif ( is_search() ) {
|
|
225
|
+
$title_text = __( 'Search results for: ', 'chisel' ) . ' ' . get_search_query();
|
|
226
|
+
} elseif ( is_404() ) {
|
|
227
|
+
$title_text = __( '404 - Page not found', 'chisel' );
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if ( $title_text ) {
|
|
231
|
+
$the_title = array(
|
|
232
|
+
'text' => esc_html( $title_text ),
|
|
233
|
+
'class' => $title_class ? esc_attr( $title_class ) : $classname,
|
|
234
|
+
);
|
|
198
235
|
}
|
|
199
236
|
|
|
200
|
-
|
|
237
|
+
self::$the_title = apply_filters( 'chisel_the_title', $the_title );
|
|
201
238
|
|
|
202
239
|
return Timber::compile(
|
|
203
240
|
'partials/the-title.twig',
|
|
204
|
-
|
|
241
|
+
array( 'the_title' => self::$the_title ),
|
|
205
242
|
ChiselCache::expiry()
|
|
206
243
|
);
|
|
207
244
|
}
|
|
@@ -398,7 +398,7 @@ class CustomPostTypes implements Instance {
|
|
|
398
398
|
// 'singular' => __( 'Chisel CPT', 'chisel' ),
|
|
399
399
|
// 'plural' => __( 'Chisel CPTs', 'chisel' ),
|
|
400
400
|
// 'supports' => array( 'editor', 'thumbnail', 'excerpt' ),
|
|
401
|
-
// '
|
|
401
|
+
// 'menu_icon' => 'location-alt',
|
|
402
402
|
// 'hierarchical' => true,
|
|
403
403
|
// 'public' => true,
|
|
404
404
|
// 'menu_position' => 20,
|
|
@@ -34,7 +34,7 @@ class ExtendedPost extends TimberPost {
|
|
|
34
34
|
*/
|
|
35
35
|
public function get_thumbnail( $size = 'medium' ) {
|
|
36
36
|
if ( ! $this->thumbnail_html ) {
|
|
37
|
-
$this->thumbnail_html = has_post_thumbnail( $this->ID ) ?
|
|
37
|
+
$this->thumbnail_html = has_post_thumbnail( $this->ID ) ? Helpers::get_responsive_image( get_post_thumbnail_id( $this->ID ), $size ) : '';
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return $this->thumbnail_html;
|
|
@@ -27,7 +27,7 @@ class ExtendedProduct extends TimberPost {
|
|
|
27
27
|
*/
|
|
28
28
|
public function get_thumbnail( $size = 'woocommerce_thumbnail' ) {
|
|
29
29
|
if ( ! $this->thumbnail_html ) {
|
|
30
|
-
$thumbnail_html = has_post_thumbnail( $this->ID ) ?
|
|
30
|
+
$thumbnail_html = has_post_thumbnail( $this->ID ) ? Helpers::get_responsive_image( get_post_thumbnail_id( $this->ID ), $size ) : '';
|
|
31
31
|
|
|
32
32
|
if ( ! $thumbnail_html ) {
|
|
33
33
|
$thumbnail_html = wc_placeholder_img( $size );
|
|
@@ -38,8 +38,8 @@ class GravityForms implements Instance {
|
|
|
38
38
|
* Register filter hooks.
|
|
39
39
|
*/
|
|
40
40
|
public function filter_hooks() {
|
|
41
|
-
add_filter( '
|
|
42
|
-
add_filter( '
|
|
41
|
+
add_filter( 'chisel_frontend_footer_styles', array( $this, 'register_custom_styles' ) );
|
|
42
|
+
add_filter( 'chisel_enqueue_frontend_footer_style', array( $this, 'enqueue_custom_styles' ), 10, 3 );
|
|
43
43
|
add_filter( 'gform_form_theme_slug', array( $this, 'default_form_styles' ), 99, 2 );
|
|
44
44
|
add_filter( 'gform_plugin_settings_fields', array( $this, 'plugin_settings_fields' ), 99 );
|
|
45
45
|
}
|
|
@@ -116,6 +116,51 @@ class GravityForms implements Instance {
|
|
|
116
116
|
return $fields;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Get list of available Gravity Forms. Can be used in acf/load_field filter to populate the select field.
|
|
121
|
+
*
|
|
122
|
+
* @return array
|
|
123
|
+
*/
|
|
124
|
+
public static function forms_list() {
|
|
125
|
+
if ( ! class_exists( 'GFForms' ) ) {
|
|
126
|
+
return array();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
$forms = \GFAPI::get_forms();
|
|
130
|
+
|
|
131
|
+
$list = array();
|
|
132
|
+
|
|
133
|
+
if ( $forms ) {
|
|
134
|
+
foreach ( $forms as $form ) {
|
|
135
|
+
$list[$form['id']] = $form['title'];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return $list;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* This function will generate the gravity form for a given id with default parameters. Use if you need to generate ajax fomr outside of blocks.
|
|
144
|
+
*
|
|
145
|
+
* @param int $form_id
|
|
146
|
+
* @param bool $display_title
|
|
147
|
+
* @param bool $display_description
|
|
148
|
+
* @param bool $display_inactive
|
|
149
|
+
* @param array $field_values
|
|
150
|
+
* @param bool $ajax
|
|
151
|
+
* @param int $tabindex
|
|
152
|
+
* @param bool $_echo
|
|
153
|
+
*
|
|
154
|
+
* @return mixed
|
|
155
|
+
*/
|
|
156
|
+
public static function get_contact_form( $form_id, $display_title = false, $display_description = false, $display_inactive = false, $field_values = null, $ajax = true, $tabindex = 0, $_echo = false ) {
|
|
157
|
+
if ( function_exists( 'gravity_form' ) ) {
|
|
158
|
+
return gravity_form( $form_id, $display_title, $display_description, $display_inactive, $field_values, $ajax, $tabindex, $_echo );
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
|
|
119
164
|
/**
|
|
120
165
|
* Check if Gravity Forms plugin is active.
|
|
121
166
|
*
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
namespace Chisel;
|
|
4
4
|
|
|
5
|
+
use Timber\Timber;
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Helper functions.
|
|
7
9
|
*
|
|
@@ -115,6 +117,71 @@ class Helpers {
|
|
|
115
117
|
return get_template_directory_uri() . $image_path;
|
|
116
118
|
}
|
|
117
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Get responsive image html
|
|
122
|
+
*
|
|
123
|
+
* @param int $image_id Image ID.
|
|
124
|
+
* @param string $image_size Image size.
|
|
125
|
+
* @param array $attrs Image attributes.
|
|
126
|
+
*
|
|
127
|
+
* @return string|html
|
|
128
|
+
*/
|
|
129
|
+
public static function get_responsive_image( $image_id, $image_size = 'medium', $attrs = array() ) {
|
|
130
|
+
if ( ! $image_id ) {
|
|
131
|
+
return '';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return Timber::get_image( $image_id )->responsive( $image_size, $attrs );
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Generate BEM class names with modifiers
|
|
139
|
+
*
|
|
140
|
+
* @param string $name
|
|
141
|
+
* @param mixed ...$modifiers
|
|
142
|
+
*
|
|
143
|
+
* @return string
|
|
144
|
+
*/
|
|
145
|
+
public static function bem( $name = '', ...$modifiers ) {
|
|
146
|
+
if ( empty( $name ) || empty( $modifiers ) ) {
|
|
147
|
+
return '';
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
$classnames = array( $name );
|
|
151
|
+
|
|
152
|
+
foreach ( $modifiers as $key => $value ) {
|
|
153
|
+
if ( is_array( $value ) ) {
|
|
154
|
+
$values = array_map(
|
|
155
|
+
function ( $val ) use ( $name, $value ) {
|
|
156
|
+
return $name . '--' . _wp_to_kebab_case( $val . '-' . $value[ $val ] );
|
|
157
|
+
},
|
|
158
|
+
array_keys( $value )
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
$classnames = array_merge( $classnames, $values );
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if ( $value === false || $value === null || $value === '' ) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if ( is_string( $key ) ) {
|
|
170
|
+
$classname = $name . '--' . _wp_to_kebab_case( $key );
|
|
171
|
+
|
|
172
|
+
if ( ! is_bool( $value ) ) {
|
|
173
|
+
$classname .= '-' . _wp_to_kebab_case( $value );
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
$classname = $name . '--' . _wp_to_kebab_case( $value );
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
$classnames[] = $classname;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return implode( ' ', $classnames );
|
|
183
|
+
}
|
|
184
|
+
|
|
118
185
|
/**
|
|
119
186
|
* Get logo data for the wp login page.
|
|
120
187
|
*
|
|
@@ -189,7 +189,8 @@ abstract class RegisterBlocks {
|
|
|
189
189
|
$block
|
|
190
190
|
);
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
// Register ignored scripts in dev mode in order to watch changes.
|
|
193
|
+
if ( Assets::is_fast_refresh() || ( ! Assets::is_fast_refresh() && ! in_array( $script, $ignore_scripts, true ) ) ) {
|
|
193
194
|
wp_register_script(
|
|
194
195
|
$block_handle,
|
|
195
196
|
$file_url,
|
|
@@ -40,7 +40,6 @@ class Site extends TimberSite implements Instance {
|
|
|
40
40
|
*/
|
|
41
41
|
public function filter_hooks() {
|
|
42
42
|
add_filter( 'timber/context', array( $this, 'add_to_context' ) );
|
|
43
|
-
add_filter( 'timber/context', array( $this, 'set_page_title' ) );
|
|
44
43
|
add_filter( 'timber/post/classmap', array( $this, 'post_classmap' ) );
|
|
45
44
|
add_filter( 'timber/term/classmap', array( $this, 'term_classmap' ) );
|
|
46
45
|
}
|
|
@@ -56,23 +55,7 @@ class Site extends TimberSite implements Instance {
|
|
|
56
55
|
$context['menus'] = Components::get_menus();
|
|
57
56
|
$context['sidebar'] = Components::get_sidebar();
|
|
58
57
|
$context['footer_sidebars'] = Components::get_footer_sidebars();
|
|
59
|
-
|
|
60
|
-
return $context;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Set the page / post title
|
|
65
|
-
*
|
|
66
|
-
* @param array $context The context.
|
|
67
|
-
*
|
|
68
|
-
* @return array
|
|
69
|
-
*/
|
|
70
|
-
public function set_page_title( $context ) {
|
|
71
|
-
global $post;
|
|
72
|
-
|
|
73
|
-
if ( isset( $post->post_type ) ) {
|
|
74
|
-
$context['the_title'] = Components::get_the_title( $post->ID );
|
|
75
|
-
}
|
|
58
|
+
$context['the_title'] = Components::get_the_title();
|
|
76
59
|
|
|
77
60
|
return $context;
|
|
78
61
|
}
|
|
@@ -47,11 +47,10 @@ class Theme implements Instance {
|
|
|
47
47
|
* Register action hooks.
|
|
48
48
|
*/
|
|
49
49
|
public function action_hooks() {
|
|
50
|
-
add_action( '
|
|
50
|
+
add_action( 'init', array( $this, 'theme_supports' ), 11 );
|
|
51
51
|
add_action( 'after_setup_theme', array( $this, 'remove_post_supports' ), 99 );
|
|
52
52
|
add_action( 'init', array( $this, 'register_nav_menus' ) );
|
|
53
53
|
add_action( 'after_setup_theme', array( $this, 'i18n' ) );
|
|
54
|
-
add_action( 'wp_head', array( $this, 'set_scrollbar_width_for_css' ) );
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
/**
|
|
@@ -145,24 +144,6 @@ class Theme implements Instance {
|
|
|
145
144
|
);
|
|
146
145
|
}
|
|
147
146
|
|
|
148
|
-
/**
|
|
149
|
-
* Calculate scrollbar width and set it as a CSS variable.
|
|
150
|
-
*/
|
|
151
|
-
public function set_scrollbar_width_for_css() {
|
|
152
|
-
?>
|
|
153
|
-
<script>
|
|
154
|
-
function getScrollbarWidth() {
|
|
155
|
-
return window.innerWidth - document.documentElement.clientWidth;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
setTimeout(() => {
|
|
159
|
-
const scrollbarWidth = getScrollbarWidth();
|
|
160
|
-
document.documentElement.style.setProperty('--scrollbar-width', `${scrollbarWidth}px`);
|
|
161
|
-
}, 10);
|
|
162
|
-
</script>
|
|
163
|
-
<?php
|
|
164
|
-
}
|
|
165
|
-
|
|
166
147
|
/**
|
|
167
148
|
* Add custom classes to the body tag.
|
|
168
149
|
*
|
|
@@ -65,6 +65,8 @@ class Twig implements Instance {
|
|
|
65
65
|
$this->register_function( $twig, 'slider_prepare_params', array( $this, 'slider_prepare_params' ) );
|
|
66
66
|
$this->register_function( $twig, 'get_responsive_image', array( $this, 'get_responsive_image' ) );
|
|
67
67
|
$this->register_function( $twig, 'comments_template', array( $this, 'comments_template' ) );
|
|
68
|
+
$this->register_function( $twig, 'bem', array( $this, 'bem' ) );
|
|
69
|
+
$this->register_function( $twig, 'breadcrumbs', array( $this, 'breadcrumbs' ) );
|
|
68
70
|
|
|
69
71
|
return $twig;
|
|
70
72
|
}
|
|
@@ -106,6 +108,36 @@ class Twig implements Instance {
|
|
|
106
108
|
return $twig;
|
|
107
109
|
}
|
|
108
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Register a Twig filter.
|
|
113
|
+
*
|
|
114
|
+
* @param \Twig_Environment $twig The Twig environment.
|
|
115
|
+
* @param string $name The name of the function.
|
|
116
|
+
* @param callable $callback The callback function.
|
|
117
|
+
*
|
|
118
|
+
* @return \Twig_Environment
|
|
119
|
+
*/
|
|
120
|
+
protected function register_filter( $twig, $name, $callback ) {
|
|
121
|
+
$twig->addFilter( new \Twig\TwigFilter( $name, $callback ) );
|
|
122
|
+
|
|
123
|
+
return $twig;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Register a Twig test.
|
|
128
|
+
*
|
|
129
|
+
* @param \Twig_Environment $twig The Twig environment.
|
|
130
|
+
* @param string $name The name of the function.
|
|
131
|
+
* @param callable $callback The callback function.
|
|
132
|
+
*
|
|
133
|
+
* @return \Twig_Environment
|
|
134
|
+
*/
|
|
135
|
+
protected function register_test( $twig, $name, $callback ) {
|
|
136
|
+
$twig->addTest( new \Twig\TwigTest( $name, $callback ) );
|
|
137
|
+
|
|
138
|
+
return $twig;
|
|
139
|
+
}
|
|
140
|
+
|
|
109
141
|
/**
|
|
110
142
|
* Get the navigation menu.
|
|
111
143
|
*
|
|
@@ -220,11 +252,12 @@ class Twig implements Instance {
|
|
|
220
252
|
*
|
|
221
253
|
* @param int $image_id Image ID.
|
|
222
254
|
* @param string $image_size Image size.
|
|
255
|
+
* @param array $attrs Image attributes.
|
|
223
256
|
*
|
|
224
|
-
* @return string
|
|
257
|
+
* @return string|html
|
|
225
258
|
*/
|
|
226
|
-
public function get_responsive_image( $image_id, $image_size ) {
|
|
227
|
-
return
|
|
259
|
+
public function get_responsive_image( $image_id, $image_size = 'medium', $attrs = array() ) {
|
|
260
|
+
return Helpers::get_responsive_image( $image_id, $image_size, $attrs );
|
|
228
261
|
}
|
|
229
262
|
|
|
230
263
|
/**
|
|
@@ -234,6 +267,27 @@ class Twig implements Instance {
|
|
|
234
267
|
return Comments::comments_template();
|
|
235
268
|
}
|
|
236
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Generate BEM class names with modifiers
|
|
272
|
+
*
|
|
273
|
+
* @param string $name
|
|
274
|
+
* @param mixed ...$modifiers
|
|
275
|
+
*
|
|
276
|
+
* @return string
|
|
277
|
+
*/
|
|
278
|
+
public function bem( $name = '', ...$modifiers ) {
|
|
279
|
+
return Helpers::bem( $name, ...$modifiers );
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Display breadcrumbs. Requires Yoast plugin.
|
|
284
|
+
*
|
|
285
|
+
* @return html
|
|
286
|
+
*/
|
|
287
|
+
public function breadcrumbs() {
|
|
288
|
+
return Yoast::breadcrumbs();
|
|
289
|
+
}
|
|
290
|
+
|
|
237
291
|
/**
|
|
238
292
|
* Get the instance of the class.
|
|
239
293
|
*/
|
|
@@ -37,6 +37,23 @@ class Yoast implements Instance {
|
|
|
37
37
|
*/
|
|
38
38
|
public function filter_hooks() {}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Display breadcrumbs.
|
|
42
|
+
*
|
|
43
|
+
* @return html
|
|
44
|
+
*/
|
|
45
|
+
public static function breadcrumbs() {
|
|
46
|
+
if ( ! self::is_yoast_active() ) {
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if ( is_front_page() ) {
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return yoast_breadcrumb( '<div class="c-breadcrumbs">', '</div>', false );
|
|
55
|
+
}
|
|
56
|
+
|
|
40
57
|
/**
|
|
41
58
|
* Check if Gravity Forms plugin is active.
|
|
42
59
|
*
|
|
@@ -10,6 +10,5 @@ use Timber\Timber;
|
|
|
10
10
|
|
|
11
11
|
$context = Timber::context();
|
|
12
12
|
$context['posts'] = Timber::get_posts();
|
|
13
|
-
$context['title'] = __( 'Search results for: ', 'chisel' ) . get_search_query();
|
|
14
13
|
|
|
15
14
|
Timber::render( array( 'search.twig', 'archive.twig', 'index.twig' ), $context, ChiselCache::expiry() );
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
@mixin get-icon($name, $extension: 'svg') {
|
|
2
|
-
|
|
1
|
+
@mixin get-icon($name, $extension: 'svg', $is-block: false) {
|
|
2
|
+
$path: '../../';
|
|
3
|
+
|
|
4
|
+
@if $is-block {
|
|
5
|
+
$path: '../../../';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
mask: url('#{$path}assets/icons/#{$name}.#{$extension}');
|
|
3
9
|
mask-repeat: no-repeat;
|
|
4
10
|
mask-size: contain;
|
|
5
11
|
}
|
|
@@ -4,3 +4,18 @@
|
|
|
4
4
|
object-fit: cover;
|
|
5
5
|
object-position: $position;
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
@mixin background-image($name, $extension: 'svg', $is-block: false, $is-icon: false) {
|
|
9
|
+
$path: '../../';
|
|
10
|
+
$folder: 'images';
|
|
11
|
+
|
|
12
|
+
@if $is-block {
|
|
13
|
+
$path: '../../../';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@if $is-icon {
|
|
17
|
+
$folder: 'icons';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
background-image: url('#{$path}assets/#{$folder}/#{$name}.#{$extension}');
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* global chiselEditorScripts */
|
|
2
|
+
|
|
3
|
+
import { addFilter } from '@wordpress/hooks';
|
|
4
|
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
5
|
+
import { useEffect } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
const chiselBlocksDefaultAlignment = createHigherOrderComponent((BlockEdit) => {
|
|
8
|
+
return (props) => {
|
|
9
|
+
const { setAttributes, isSelected, name } = props;
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (isSelected) {
|
|
13
|
+
const alignment = chiselEditorScripts?.blocksDefaultAlignment?.[name];
|
|
14
|
+
|
|
15
|
+
if (alignment) {
|
|
16
|
+
setAttributes({
|
|
17
|
+
align: alignment,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return <BlockEdit {...props} />;
|
|
24
|
+
};
|
|
25
|
+
}, 'coreButtonCustomControls');
|
|
26
|
+
addFilter('editor.BlockEdit', 'chisel/button-block', chiselBlocksDefaultAlignment);
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-button.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { addFilter } from '@wordpress/hooks';
|
|
3
3
|
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
4
|
-
import { Fragment } from '@wordpress/element';
|
|
5
|
-
import { PanelBody, SelectControl } from '@wordpress/components';
|
|
4
|
+
import { Fragment, useEffect } from '@wordpress/element';
|
|
5
|
+
import { PanelBody, SelectControl, ToggleControl } from '@wordpress/components';
|
|
6
6
|
import { InspectorControls } from '@wordpress/blockEditor';
|
|
7
7
|
import Utils from '../utils';
|
|
8
8
|
|
|
@@ -35,6 +35,10 @@ const chiselButtonBlockAttributes = (settings, name) => {
|
|
|
35
35
|
type: 'string',
|
|
36
36
|
default: '',
|
|
37
37
|
},
|
|
38
|
+
buttonIconPosition: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
38
42
|
}),
|
|
39
43
|
});
|
|
40
44
|
}
|
|
@@ -45,15 +49,47 @@ addFilter('blocks.registerBlockType', 'chisel/button-block', chiselButtonBlockAt
|
|
|
45
49
|
|
|
46
50
|
const chiselButtonCustomControls = createHigherOrderComponent((BlockEdit) => {
|
|
47
51
|
return (props) => {
|
|
48
|
-
const { attributes, setAttributes, isSelected } = props;
|
|
52
|
+
const { attributes, setAttributes, isSelected, name } = props;
|
|
53
|
+
|
|
54
|
+
if (name !== blockName) {
|
|
55
|
+
return <BlockEdit {...props} />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let {
|
|
59
|
+
buttonSize = '',
|
|
60
|
+
className = '',
|
|
61
|
+
buttonIcon = '',
|
|
62
|
+
buttonIconPosition = false,
|
|
63
|
+
} = attributes;
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (isSelected && className !== '') {
|
|
67
|
+
const attrs = {};
|
|
68
|
+
const size = className.match(/is-size-(\w*)/);
|
|
69
|
+
const icon = className.match(/has-icon-(\w*)/);
|
|
70
|
+
const iconLeft = className.match('has-icon-left');
|
|
49
71
|
|
|
50
|
-
|
|
72
|
+
if (icon.length) {
|
|
73
|
+
attrs.buttonIcon = icon[1];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (size.length) {
|
|
77
|
+
attrs.buttonSize = size[1];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (iconLeft) {
|
|
81
|
+
attrs.buttonIconPosition = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
setAttributes(attrs);
|
|
85
|
+
}
|
|
86
|
+
}, []);
|
|
51
87
|
|
|
52
88
|
return (
|
|
53
89
|
<Fragment>
|
|
54
90
|
<BlockEdit {...props} />
|
|
55
91
|
|
|
56
|
-
{isSelected &&
|
|
92
|
+
{isSelected && (
|
|
57
93
|
<InspectorControls>
|
|
58
94
|
<PanelBody title={__('Button Size', 'lps')}>
|
|
59
95
|
<SelectControl
|
|
@@ -94,6 +130,25 @@ const chiselButtonCustomControls = createHigherOrderComponent((BlockEdit) => {
|
|
|
94
130
|
}}
|
|
95
131
|
/>
|
|
96
132
|
</PanelBody>
|
|
133
|
+
<PanelBody title={__('Icon Position', 'lps')}>
|
|
134
|
+
<ToggleControl
|
|
135
|
+
label={__('Icon on the left', 'chisel')}
|
|
136
|
+
help={__('By default icons are on the right', 'chisel')}
|
|
137
|
+
checked={!!buttonIconPosition}
|
|
138
|
+
onChange={(isLeft) => {
|
|
139
|
+
className = className.replace('has-icon-left', '').trim();
|
|
140
|
+
|
|
141
|
+
if (isLeft) {
|
|
142
|
+
className += ' has-icon-left';
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
setAttributes({
|
|
146
|
+
buttonIconPosition: isLeft,
|
|
147
|
+
className,
|
|
148
|
+
});
|
|
149
|
+
}}
|
|
150
|
+
/>
|
|
151
|
+
</PanelBody>
|
|
97
152
|
</InspectorControls>
|
|
98
153
|
)}
|
|
99
154
|
</Fragment>
|
|
@@ -180,7 +180,12 @@ class Slider {
|
|
|
180
180
|
/*
|
|
181
181
|
* Set default slider params. This params will only apply to default slider type.
|
|
182
182
|
*/
|
|
183
|
-
defaultSliderParams() {
|
|
183
|
+
defaultSliderParams() {
|
|
184
|
+
this.params = {
|
|
185
|
+
...this.params,
|
|
186
|
+
spaceBetween: 0,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
184
189
|
|
|
185
190
|
/*
|
|
186
191
|
* Create and initialize arrows navigation.
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss
CHANGED
|
@@ -90,18 +90,37 @@ $_buttons-icons: settings.$buttons-icons;
|
|
|
90
90
|
@include button-icon;
|
|
91
91
|
|
|
92
92
|
.wp-block-button__link {
|
|
93
|
-
&::after
|
|
93
|
+
&::after,
|
|
94
|
+
&::before {
|
|
95
|
+
display: block;
|
|
94
96
|
width: px-rem(24);
|
|
95
97
|
height: px-rem(24);
|
|
96
98
|
margin-left: px-rem(8);
|
|
97
99
|
content: '';
|
|
98
100
|
}
|
|
101
|
+
|
|
102
|
+
&::before {
|
|
103
|
+
display: none;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.has-icon-left .wp-block-button__link {
|
|
108
|
+
&::before {
|
|
109
|
+
display: block;
|
|
110
|
+
margin-right: px-rem(8);
|
|
111
|
+
margin-left: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&::after {
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
99
117
|
}
|
|
100
118
|
}
|
|
101
119
|
|
|
102
120
|
@each $button-icon in $_buttons-icons {
|
|
103
121
|
&.has-icon-#{$button-icon} .wp-block-button__link {
|
|
104
|
-
&::after
|
|
122
|
+
&::after,
|
|
123
|
+
&::before {
|
|
105
124
|
@include get-icon($button-icon);
|
|
106
125
|
}
|
|
107
126
|
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss
CHANGED
|
@@ -87,17 +87,36 @@ $_buttons-icons: settings.$buttons-icons;
|
|
|
87
87
|
.c-btn.has-icon {
|
|
88
88
|
@include button-icon;
|
|
89
89
|
|
|
90
|
-
&::after
|
|
90
|
+
&::after,
|
|
91
|
+
&::before {
|
|
92
|
+
display: block;
|
|
91
93
|
width: px-rem(24);
|
|
92
94
|
height: px-rem(24);
|
|
93
95
|
margin-left: px-rem(8);
|
|
94
96
|
content: '';
|
|
95
97
|
}
|
|
98
|
+
|
|
99
|
+
&::before {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.has-icon-left {
|
|
104
|
+
&::before {
|
|
105
|
+
display: block;
|
|
106
|
+
margin-right: px-rem(8);
|
|
107
|
+
margin-left: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&::after {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
96
114
|
}
|
|
97
115
|
|
|
98
116
|
@each $button-icon in $_buttons-icons {
|
|
99
117
|
.c-btn.has-icon-#{$button-icon} {
|
|
100
|
-
&::after
|
|
118
|
+
&::after,
|
|
119
|
+
&::before {
|
|
101
120
|
@include get-icon($button-icon);
|
|
102
121
|
}
|
|
103
122
|
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_slider.scss
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
img {
|
|
16
16
|
@include object-fit-cover;
|
|
17
|
+
aspect-ratio: 16 / 9;
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -29,6 +30,9 @@
|
|
|
29
30
|
transform: translateY(-50%);
|
|
30
31
|
|
|
31
32
|
.swiper-button {
|
|
33
|
+
top: 50%;
|
|
34
|
+
transform: translateY(-50%);
|
|
35
|
+
margin: 0;
|
|
32
36
|
width: px-rem(48);
|
|
33
37
|
height: px-rem(48);
|
|
34
38
|
appearance: none;
|
|
@@ -73,10 +77,19 @@
|
|
|
73
77
|
border-radius: get-border-radius('tiny');
|
|
74
78
|
transition: get-transition('normal');
|
|
75
79
|
transform: translateX(-50%);
|
|
80
|
+
line-height: 1;
|
|
81
|
+
font-size: 0;
|
|
76
82
|
|
|
77
83
|
&:hover {
|
|
78
84
|
background-color: rgba(255, 255, 255, 100%);
|
|
79
85
|
}
|
|
86
|
+
|
|
87
|
+
.swiper-pagination-bullet {
|
|
88
|
+
width: px-rem(10);
|
|
89
|
+
height: px-rem(10);
|
|
90
|
+
background-color: get-color('primary');
|
|
91
|
+
opacity: 0.3;
|
|
92
|
+
}
|
|
80
93
|
}
|
|
81
94
|
|
|
82
95
|
.swiper-pagination.swiper-pagination-horizontal {
|
|
@@ -85,13 +98,6 @@
|
|
|
85
98
|
transform: none !important;
|
|
86
99
|
}
|
|
87
100
|
|
|
88
|
-
.swiper-pagination-bullet {
|
|
89
|
-
width: px-rem(10);
|
|
90
|
-
height: px-rem(10);
|
|
91
|
-
background-color: get-color('primary');
|
|
92
|
-
opacity: 0.3;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
101
|
.swiper-pagination-bullet-active-main,
|
|
96
102
|
.swiper-pagination:not(.swiper-pagination-dots-dynamic) .swiper-pagination-bullet-active {
|
|
97
103
|
background-color: get-color('secondary');
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/vendor/_breadcrumbs.scss
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@use '~design' as *;
|
|
2
|
+
@use '../../design/settings/' as *;
|
|
3
|
+
|
|
4
|
+
.c-breadcrumbs {
|
|
5
|
+
position: relative;
|
|
6
|
+
max-width: $full-width;
|
|
7
|
+
margin-inline: auto;
|
|
8
|
+
font-size: get-font-size('small');
|
|
9
|
+
|
|
10
|
+
span {
|
|
11
|
+
span {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
margin-inline: px-rem(8);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@use '../components
|
|
1
|
+
@use '../components/slider';
|
|
2
2
|
|
|
3
|
-
.
|
|
3
|
+
.b-slider {
|
|
4
4
|
.swiper {
|
|
5
5
|
opacity: 1;
|
|
6
6
|
transition: get-transition('slow');
|
|
@@ -9,4 +9,13 @@
|
|
|
9
9
|
.swiper-wrapper {
|
|
10
10
|
display: flex;
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
.swiper-slide {
|
|
14
|
+
width: 100%;
|
|
15
|
+
flex: 1 0 100%;
|
|
16
|
+
|
|
17
|
+
&:nth-child(n+2) {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
12
21
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{% extends "single.twig" %}
|
|
2
2
|
|
|
3
3
|
{% block inner_content %}
|
|
4
|
-
<
|
|
5
|
-
<h2>{{ __('Sorry, we couldn\'t find what you\'re looking for', 'chisel') }}</h2>
|
|
4
|
+
<h2>{{ __('Sorry, we couldn\'t find what you\'re looking for.', 'chisel') }}</h2>
|
|
6
5
|
{% endblock %}
|
|
7
6
|
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
{% block content %}
|
|
4
4
|
<section class="o-wrapper__inner c-blog">
|
|
5
|
-
{
|
|
6
|
-
<h1>{{ title }}</h1>
|
|
7
|
-
{% endif %}
|
|
5
|
+
{{ the_title }}
|
|
8
6
|
|
|
9
7
|
{% block before_loop %}
|
|
10
8
|
{% endblock %}
|
|
@@ -17,7 +15,7 @@
|
|
|
17
15
|
{% include "components/post-item.twig" with {post: post} %}
|
|
18
16
|
{% endfor %}
|
|
19
17
|
{% else %}
|
|
20
|
-
<h2>{{ __('No
|
|
18
|
+
<h2>{{ __('No posts found', 'chisel') }}</h2>
|
|
21
19
|
{% endif %}
|
|
22
20
|
</div>
|
|
23
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-chisel",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.6",
|
|
4
4
|
"description": "A generator for scaffolding front-end and WordPress projects",
|
|
5
5
|
"bin": {
|
|
6
6
|
"chisel": "bin/chisel.js"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"tinyqueue": "^2.0.3",
|
|
38
38
|
"update-notifier": "^4.1.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "3e570080e27006edf6ae11791aa5e70c5622bf91"
|
|
41
41
|
}
|