generator-chisel 2.0.0-alpha.9 → 2.1.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 +58 -0
- package/bin/chisel.js +6 -0
- package/lib/commands/create/Creator.js +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.gitignore.chisel-tpl +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/404.php +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/README.md +37 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_6772609e3c28c.json +83 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_6772615562fb4.json +49 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/archive.php +2 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/block.json +31 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/edit.js +35 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/editor.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/index.js +45 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/save.js +20 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/script.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/style.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/view.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example/view.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/block.json +32 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/edit.js +33 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/editor.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/index.js +45 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/render.php +12 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/render.twig +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/save.js +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/script.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/style.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/view.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks/example-server-side/view.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/block.json +36 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/critical.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/editor.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/example.twig +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/index.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/init.php +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/script.js +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/style.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/view.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/example-blocks/blocks-acf/example/view.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/arrow-left.svg +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/arrow-right.svg +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/chisel-icon.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/chisel-logo.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/close-line.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/color/chisel-icon.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/color/chisel-logo.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/color/facebook-logo.svg +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/color/instagram-logo.svg +14 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/x-logo.svg +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/author.php +3 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/composer.json +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/footer.php +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/functions.php +18 -24
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes/Ajax.php → inc/Controllers/AjaxController.php} +16 -41
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factory/RegisterAcfOptionsPage.php +62 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/Factory}/RegisterBlocks.php +53 -22
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factory/RegisterCustomPostType.php +211 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factory/RegisterCustomTaxonomy.php +174 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/AcfHelpers.php +46 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/AjaxHelpers.php +33 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/AssetsHelpers.php +28 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/BlocksHelpers.php +118 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/CacheHelpers.php +41 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/CommentsHelpers.php +26 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/DataHelpers.php +35 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/GravityFormsHelpers.php +65 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/ImageHelpers.php +102 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes/Helpers.php → inc/Helper/ThemeHelpers.php} +53 -93
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/WoocommerceHelpers.php +72 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/YoastHelpers.php +37 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes/interfaces/Instance.php → inc/Interfaces/HooksInterface.php} +3 -8
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/InstanceInterface.php +16 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/Plugin}/GravityForms.php +15 -72
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/Plugin}/Woocommerce.php +54 -80
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Plugin/Yoast.php +46 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Traits/PageBlocks.php +92 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Traits/Singleton.php +23 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Acf.php +125 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/AcfBlocks.php +62 -61
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/AjaxEnpoints.php +6 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/Assets.php +258 -119
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/Blocks.php +63 -51
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Cache.php +103 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes/ExtendedImage.php → inc/WP/ChiselImage.php} +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes/ExtendedPost.php → inc/WP/ChiselPost.php} +4 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/ChiselProduct.php +66 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/ChiselProductCategory.php +66 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes/ExtendedTerm.php → inc/WP/ChiselTerm.php} +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/Comments.php +10 -32
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/Components.php +61 -36
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/CustomPostTypes.php +124 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/CustomTaxonomies.php +129 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/Sidebars.php +11 -17
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/Site.php +16 -21
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/Theme.php +22 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/{classes → inc/WP}/Twig.php +34 -21
- package/lib/commands/create/creators/app/chisel-starter-theme/index.php +2 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +5 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/page.php +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/phpcs.xml +5 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/search.php +3 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/single.php +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/accordion-item.js +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/style.scss +12 -5
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/acf-json/group_66462c70b851f.json +107 -105
- 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 +4 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +2 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_buttons.scss +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_icon.scss +39 -7
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_index.scss +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_layout.scss +11 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/admin/acf.js +65 -1
- 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.js +10 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core-button.js +13 -9
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/utils.js +0 -12
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/loaded.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/admin.scss +2 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss +14 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +14 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_icons-preview.scss +97 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav.scss +19 -9
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_posts-items.scss +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_icon.scss +51 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_layout.scss +0 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-admin/_acf.scss +29 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-admin/_index.scss +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/twig_cs.php +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/base.twig +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/header.twig +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/{partials → components}/logo.twig +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav-item.twig +2 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav.twig +5 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/pagination.twig +70 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/slider.twig +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/{partials → components}/the-title.twig +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +10 -5
- package/lib/commands/create/creators/app/chisel-starter-theme/views/objects/icon.twig +37 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/icons-preview.twig +81 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/sidebar-blog.twig +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/sidebar-woocommerce.twig +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/single.twig +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/archive-product.twig +10 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/content-product-cat.twig +42 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/linked-products.twig +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/single-product.twig +4 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/woocommerce.php +25 -15
- package/lib/commands/create/creators/app/index.js +74 -20
- package/lib/commands/create/creators/app/template/.devcontainer/Dockerfile +21 -0
- package/lib/commands/create/creators/app/template/.devcontainer/compose.chisel-tpl +3 -0
- package/lib/commands/create/creators/app/template/.devcontainer/devcontainer.json.chisel-tpl +31 -0
- package/lib/commands/create/creators/app/template/.devcontainer/docker-compose.yml.chisel-tpl +40 -0
- package/lib/commands/create/creators/app/template/.devcontainer/exec +8 -0
- package/lib/commands/create/creators/app/template/.devcontainer/post-create-command.sh.chisel-tpl +24 -0
- package/lib/commands/create/creators/devcontainer.js +62 -0
- package/lib/commands/create/creators/utils.js +58 -0
- package/lib/commands/create/creators/wp/index.js +25 -3
- package/lib/commands/create/creators/wp-plugins/index.js +1 -0
- package/lib/commands/create/creators/wp-plugins/plugins.json +3 -2
- package/lib/commands/create/index.js +9 -2
- package/lib/commands/create/packages-versions.js +3 -3
- package/package.json +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Acf.php +0 -188
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/AcfSync.php +0 -230
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ChiselCache.php +0 -87
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/CustomPostTypes.php +0 -444
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedProduct.php +0 -41
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Yoast.php +0 -78
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/acf-sync.js +0 -26
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/acf-sync.scss +0 -64
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_icon.scss +0 -19
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/icon.twig +0 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/pagination.twig +0 -70
- /package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons/{loader.svg → animated/loader.svg} +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/assets/{icons → icons-source}/minus.svg +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/assets/{icons → icons-source}/plus.svg +0 -0
|
@@ -1,444 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
namespace Chisel;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Custom post types and taxonomies wrapper class.
|
|
7
|
-
*
|
|
8
|
-
* @package Chisel
|
|
9
|
-
*/
|
|
10
|
-
class CustomPostTypes implements Instance {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Post types.
|
|
14
|
-
*
|
|
15
|
-
* @var array
|
|
16
|
-
*/
|
|
17
|
-
protected $post_types = array();
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Taxonomies.
|
|
21
|
-
*
|
|
22
|
-
* @var array
|
|
23
|
-
*/
|
|
24
|
-
protected $taxonomies = array();
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Class constructor.
|
|
28
|
-
*/
|
|
29
|
-
private function __construct() {
|
|
30
|
-
$this->set_properties();
|
|
31
|
-
$this->action_hooks();
|
|
32
|
-
$this->filter_hooks();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Set properties.
|
|
37
|
-
*/
|
|
38
|
-
public function set_properties() {
|
|
39
|
-
$this->set_post_types();
|
|
40
|
-
$this->set_taxonomies();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Register action hooks.
|
|
45
|
-
*/
|
|
46
|
-
public function action_hooks() {
|
|
47
|
-
add_action( 'init', array( $this, 'register_post_types' ) );
|
|
48
|
-
add_action( 'init', array( $this, 'register_taxonomies' ) );
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Register filter hooks.
|
|
53
|
-
*/
|
|
54
|
-
public function filter_hooks() {
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Register custom post types.
|
|
59
|
-
*/
|
|
60
|
-
public function register_post_types() {
|
|
61
|
-
$this->post_types = apply_filters( 'chisel_custom_post_types', $this->post_types );
|
|
62
|
-
|
|
63
|
-
if ( empty( $this->post_types ) ) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
$default_supports = apply_filters( 'chisel_default_post_type_supports', array( 'title', 'page-attributes', 'revisions', 'author', 'editor' ) );
|
|
68
|
-
$default_rewrite = array(
|
|
69
|
-
'slug' => '',
|
|
70
|
-
'with_front' => true,
|
|
71
|
-
'feeds' => true,
|
|
72
|
-
'pages' => true,
|
|
73
|
-
'ep_mask' => EP_PERMALINK,
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
foreach ( $this->post_types as $post_type => $post_type_args ) {
|
|
77
|
-
$labels = $this->get_post_type_labels( $post_type_args );
|
|
78
|
-
|
|
79
|
-
// This is a custom arg to remove 'editor' support for a post type.
|
|
80
|
-
if ( isset( $post_type_args['show_editor'] ) && $post_type_args['show_editor'] === false ) {
|
|
81
|
-
$key = array_search( 'editor', $default_supports, true );
|
|
82
|
-
if ( false !== $key ) {
|
|
83
|
-
unset( $default_supports[$key] );
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if ( ! isset( $post_type_args['show_in_rest'] ) ) {
|
|
87
|
-
$post_type_args['show_in_rest'] = false;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
$default_supports = apply_filters( 'chisel_default_post_type_supports_' . $post_type, $default_supports );
|
|
92
|
-
$default_rewrite['slug'] = $post_type;
|
|
93
|
-
|
|
94
|
-
$description = isset( $post_type_args['description'] ) ? $post_type_args['description'] : '';
|
|
95
|
-
$public = isset( $post_type_args['public'] ) ? $post_type_args['public'] : true;
|
|
96
|
-
$hierarchical = isset( $post_type_args['hierarchical'] ) ? $post_type_args['hierarchical'] : false; // true for pages like post type.
|
|
97
|
-
$exclude_from_search = isset( $post_type_args['exclude_from_search'] ) ? $post_type_args['exclude_from_search'] : ! $public;
|
|
98
|
-
$publicly_queryable = isset( $post_type_args['publicly_queryable'] ) ? $post_type_args['publicly_queryable'] : $public;
|
|
99
|
-
$show_ui = isset( $post_type_args['show_ui'] ) ? $post_type_args['show_ui'] : $public; // show in admin.
|
|
100
|
-
$show_in_menu = isset( $post_type_args['show_in_menu'] ) ? $post_type_args['show_in_menu'] : $public; // if or where to show in admin menu - show_ui must be true. If a string of an existing top level menu ('tools.php' or 'edit.php?post_type=page', for example), the post type will be placed as a sub-menu of that.
|
|
101
|
-
$show_in_nav_menus = isset( $post_type_args['show_in_nav_menus'] ) ? $post_type_args['show_in_nav_menus'] : $public;
|
|
102
|
-
$show_in_admin_bar = isset( $post_type_args['show_in_admin_bar'] ) ? $post_type_args['show_in_admin_bar'] : $show_in_menu;
|
|
103
|
-
$show_in_rest = isset( $post_type_args['show_in_rest'] ) ? $post_type_args['show_in_rest'] : true; // set to false to disable block editor. Supports array must also include 'editor'.
|
|
104
|
-
$menu_position = isset( $post_type_args['menu_position'] ) ? $post_type_args['menu_position'] : null;
|
|
105
|
-
$menu_icon = isset( $post_type_args['menu_icon'] ) ? $post_type_args['menu_icon'] : 'dashicons-admin-post';
|
|
106
|
-
$capability_type = isset( $post_type_args['capability_type'] ) ? $post_type_args['capability_type'] : 'post';
|
|
107
|
-
$capabilities = isset( $post_type_args['capabilities'] ) ? $post_type_args['capabilities'] : array();
|
|
108
|
-
$supports = isset( $post_type_args['supports'] ) ? wp_parse_args( $post_type_args['supports'], $default_supports ) : $default_supports;
|
|
109
|
-
$has_archive = isset( $post_type_args['has_archive'] ) ? $post_type_args['has_archive'] : true;
|
|
110
|
-
$rewrite = isset( $post_type_args['rewrite'] ) ? wp_parse_args( $post_type_args['rewrite'], $default_rewrite ) : $default_rewrite;
|
|
111
|
-
$query_var = isset( $post_type_args['query_var'] ) ? $post_type_args['query_var'] : $post_type;
|
|
112
|
-
$can_export = isset( $post_type_args['can_export'] ) ? $post_type_args['can_export'] : true;
|
|
113
|
-
|
|
114
|
-
if ( in_array( 'thumbnail', $supports, true ) ) {
|
|
115
|
-
add_filter(
|
|
116
|
-
'chisel_post_thumbnails_post_types',
|
|
117
|
-
function ( $pts ) use ( $post_type ) {
|
|
118
|
-
$pts[] = $post_type;
|
|
119
|
-
return $pts;
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
$args = array(
|
|
125
|
-
'label' => $post_type_args['plural'],
|
|
126
|
-
'labels' => $labels,
|
|
127
|
-
'description' => $description,
|
|
128
|
-
'public' => $public,
|
|
129
|
-
'hierarchical' => $hierarchical,
|
|
130
|
-
'exclude_from_search' => $exclude_from_search,
|
|
131
|
-
'publicly_queryable' => $publicly_queryable,
|
|
132
|
-
'show_ui' => $show_ui,
|
|
133
|
-
'show_in_menu' => $show_in_menu,
|
|
134
|
-
'show_in_nav_menus' => $show_in_nav_menus,
|
|
135
|
-
'show_in_admin_bar' => $show_in_admin_bar,
|
|
136
|
-
'show_in_rest' => $show_in_rest,
|
|
137
|
-
'menu_position' => $menu_position,
|
|
138
|
-
'menu_icon' => $menu_icon,
|
|
139
|
-
'capability_type' => $capability_type,
|
|
140
|
-
'capabilities' => $capabilities,
|
|
141
|
-
'supports' => $supports,
|
|
142
|
-
'has_archive' => $has_archive,
|
|
143
|
-
'rewrite' => $rewrite,
|
|
144
|
-
'query_var' => $query_var,
|
|
145
|
-
'can_export' => $can_export,
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
$other_args = array(
|
|
149
|
-
'rest_base',
|
|
150
|
-
'rest_namespace',
|
|
151
|
-
'rest_controller_class',
|
|
152
|
-
'autosave_rest_controller_class',
|
|
153
|
-
'revisions_rest_controller_class',
|
|
154
|
-
'late_route_registration',
|
|
155
|
-
'map_meta_cap',
|
|
156
|
-
'register_meta_box_cb',
|
|
157
|
-
'taxonomies',
|
|
158
|
-
'template',
|
|
159
|
-
'template_lock',
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
foreach ( $other_args as $arg ) {
|
|
163
|
-
if ( isset( $post_type_args[$arg] ) ) {
|
|
164
|
-
$args[$arg] = $post_type_args[$arg];
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
register_post_type( $post_type, $args );
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Register custom taxonomies.
|
|
174
|
-
*/
|
|
175
|
-
public function register_taxonomies() {
|
|
176
|
-
$this->taxonomies = apply_filters( 'chisel_custom_taxonomies', $this->taxonomies );
|
|
177
|
-
|
|
178
|
-
if ( empty( $this->taxonomies ) ) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
$default_rewrite = array(
|
|
183
|
-
'slug' => '',
|
|
184
|
-
'with_front' => true,
|
|
185
|
-
'hierarchical' => true,
|
|
186
|
-
'ep_mask' => EP_NONE,
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
$default_capabilities = array(
|
|
190
|
-
'manage_terms' => 'manage_categories',
|
|
191
|
-
'edit_terms' => 'manage_categories',
|
|
192
|
-
'delete_terms' => 'manage_categories',
|
|
193
|
-
'assign_terms' => 'edit_posts',
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
foreach ( $this->taxonomies as $taxonomy => $taxonomy_args ) {
|
|
197
|
-
$labels = $this->get_taxonomy_labels( $taxonomy_args );
|
|
198
|
-
|
|
199
|
-
$default_rewrite['slug'] = $taxonomy;
|
|
200
|
-
|
|
201
|
-
$description = isset( $taxonomy_args['description'] ) ? $taxonomy_args['description'] : '';
|
|
202
|
-
$public = isset( $taxonomy_args['public'] ) ? $taxonomy_args['public'] : true;
|
|
203
|
-
$publicly_queryable = isset( $taxonomy_args['publicly_queryable'] ) ? $taxonomy_args['publicly_queryable'] : $public;
|
|
204
|
-
$hierarchical = isset( $taxonomy_args['hierarchical'] ) ? $taxonomy_args['hierarchical'] : false; // true for a taxonomy like categories.
|
|
205
|
-
$show_ui = isset( $taxonomy_args['show_ui'] ) ? $taxonomy_args['show_ui'] : $public; // show in admin.
|
|
206
|
-
$show_in_menu = isset( $taxonomy_args['show_in_menu'] ) ? $taxonomy_args['show_in_menu'] : $show_ui; // Show in admin menu (as a submenu of post type).
|
|
207
|
-
$show_in_nav_menus = isset( $taxonomy_args['show_in_nav_menus'] ) ? $taxonomy_args['show_in_nav_menus'] : $public;
|
|
208
|
-
$show_in_rest = isset( $taxonomy_args['show_in_rest'] ) ? $taxonomy_args['show_in_rest'] : true; // set to false to hide in block editor.
|
|
209
|
-
$show_tagcloud = isset( $taxonomy_args['show_tagcloud'] ) ? $taxonomy_args['show_tagcloud'] : $show_ui;
|
|
210
|
-
$show_in_quick_edit = isset( $taxonomy_args['show_in_quick_edit'] ) ? $taxonomy_args['show_in_quick_edit'] : $show_ui;
|
|
211
|
-
$show_admin_column = isset( $taxonomy_args['show_admin_column'] ) ? $taxonomy_args['show_admin_column'] : $public;
|
|
212
|
-
$capabilities = isset( $taxonomy_args['capabilities'] ) ? wp_parse_args( $taxonomy_args['capabilities'], $default_capabilities ) : $default_capabilities;
|
|
213
|
-
$rewrite = isset( $taxonomy_args['rewrite'] ) ? wp_parse_args( $taxonomy_args['rewrite'], $default_rewrite ) : $default_rewrite;
|
|
214
|
-
$query_var = isset( $taxonomy_args['query_var'] ) ? $taxonomy_args['query_var'] : $taxonomy;
|
|
215
|
-
$show_in_rest = isset( $taxonomy_args['show_in_rest'] ) ? $taxonomy_args['show_in_rest'] : true;
|
|
216
|
-
$rest_base = isset( $taxonomy_args['rest_base'] ) ? $taxonomy_args['rest_base'] : $taxonomy;
|
|
217
|
-
|
|
218
|
-
$args = array(
|
|
219
|
-
'labels' => $labels,
|
|
220
|
-
'description' => $description,
|
|
221
|
-
'public' => $public,
|
|
222
|
-
'publicly_queryable' => $publicly_queryable,
|
|
223
|
-
'hierarchical' => $hierarchical,
|
|
224
|
-
'show_ui' => $show_ui,
|
|
225
|
-
'show_in_menu' => $show_in_menu,
|
|
226
|
-
'show_in_nav_menus' => $show_in_nav_menus,
|
|
227
|
-
'show_tagcloud' => $show_tagcloud,
|
|
228
|
-
'show_in_quick_edit' => $show_in_quick_edit,
|
|
229
|
-
'show_admin_column' => $show_admin_column,
|
|
230
|
-
'capabilities' => $capabilities,
|
|
231
|
-
'rewrite' => $rewrite,
|
|
232
|
-
'query_var' => $query_var,
|
|
233
|
-
'show_in_rest' => $show_in_rest,
|
|
234
|
-
'rest_base' => $rest_base,
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
$other_args = array(
|
|
238
|
-
'rest_base',
|
|
239
|
-
'rest_namespace',
|
|
240
|
-
'rest_controller_class',
|
|
241
|
-
'meta_box_cb',
|
|
242
|
-
'default_term',
|
|
243
|
-
'sort',
|
|
244
|
-
'args',
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
foreach ( $other_args as $arg ) {
|
|
248
|
-
if ( isset( $taxonomy_args[$arg] ) ) {
|
|
249
|
-
$args[$arg] = $taxonomy_args[$arg];
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
register_taxonomy( $taxonomy, $taxonomy_args['post_types'], $args );
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Get post type labels.
|
|
259
|
-
*
|
|
260
|
-
* @param array $post_type_args Post type.
|
|
261
|
-
*
|
|
262
|
-
* @return array
|
|
263
|
-
*/
|
|
264
|
-
protected function get_post_type_labels( $post_type_args ) {
|
|
265
|
-
$labels = array(
|
|
266
|
-
'name' => $post_type_args['plural'],
|
|
267
|
-
'singular_name' => $post_type_args['singular'],
|
|
268
|
-
'add_new' => __( 'Add New', 'chisel' ),
|
|
269
|
-
// translators: %s is the singular name of the post type.
|
|
270
|
-
'add_new_item' => sprintf( __( 'Add New %s', 'chisel' ), $post_type_args['singular'] ),
|
|
271
|
-
// translators: %s is the singular name of the post type.
|
|
272
|
-
'edit_item' => sprintf( __( 'Edit %s', 'chisel' ), $post_type_args['singular'] ),
|
|
273
|
-
// translators: %s is the singular name of the post type.
|
|
274
|
-
'new_item' => sprintf( __( 'New %s', 'chisel' ), $post_type_args['singular'] ),
|
|
275
|
-
// translators: %s is the plural name of the post type.
|
|
276
|
-
'all_items' => sprintf( __( 'All %s', 'chisel' ), $post_type_args['plural'] ),
|
|
277
|
-
// translators: %s is the singular name of the post type.
|
|
278
|
-
'view_item' => sprintf( __( 'View %s', 'chisel' ), $post_type_args['singular'] ),
|
|
279
|
-
// translators: %s is the plural name of the post type.
|
|
280
|
-
'search_items' => sprintf( __( 'Search %s', 'chisel' ), $post_type_args['plural'] ),
|
|
281
|
-
// translators: %s is the plural name of the post type.
|
|
282
|
-
'not_found' => sprintf( __( 'No %s found', 'chisel' ), $post_type_args['plural'] ),
|
|
283
|
-
// translators: %s is the plural name of the post type.
|
|
284
|
-
'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'chisel' ), $post_type_args['plural'] ),
|
|
285
|
-
'parent_item_colon' => '',
|
|
286
|
-
'menu_name' => $post_type_args['plural'],
|
|
287
|
-
// translators: %s is the singular name of the post type.
|
|
288
|
-
'archives' => sprintf( __( '%s Archives', 'chisel' ), $post_type_args['singular'] ),
|
|
289
|
-
// translators: %s is the singular name of the post type.
|
|
290
|
-
'attributes' => sprintf( __( '%s Attributes', 'chisel' ), $post_type_args['singular'] ),
|
|
291
|
-
// translators: %s is the singular name of the post type.
|
|
292
|
-
'insert_into_item' => sprintf( __( 'Insert into %s', 'chisel' ), $post_type_args['singular'] ),
|
|
293
|
-
// translators: %s is the singular name of the post type.
|
|
294
|
-
'uploaded_to_this_item' => sprintf( __( 'Uploaded to this %s', 'chisel' ), $post_type_args['singular'] ),
|
|
295
|
-
'featured_image' => __( 'Featured Image', 'chisel' ),
|
|
296
|
-
'set_featured_image' => __( 'Set featured image', 'chisel' ),
|
|
297
|
-
'remove_featured_image' => __( 'Remove featured image', 'chisel' ),
|
|
298
|
-
'use_featured_image' => __( 'Use as featured image', 'chisel' ),
|
|
299
|
-
// translators: %s is the plural name of the post type.
|
|
300
|
-
'filter_items_list' => sprintf( __( 'Filter %s list', 'chisel' ), $post_type_args['plural'] ),
|
|
301
|
-
'filter_by_date' => __( 'Filter by date', 'chisel' ),
|
|
302
|
-
// translators: %s is the plural name of the post type.
|
|
303
|
-
'items_list_navigation' => sprintf( __( '%s list navigation', 'chisel' ), $post_type_args['plural'] ),
|
|
304
|
-
// translators: %s is the plural name of the post type.
|
|
305
|
-
'items_list' => sprintf( __( '%s list', 'chisel' ), $post_type_args['plural'] ),
|
|
306
|
-
// translators: %s is the singular name of the post type.
|
|
307
|
-
'item_published' => sprintf( __( '%s published', 'chisel' ), $post_type_args['singular'] ),
|
|
308
|
-
// translators: %s is the singular name of the post type.
|
|
309
|
-
'item_published_privately' => sprintf( __( '%s published privately', 'chisel' ), $post_type_args['singular'] ),
|
|
310
|
-
// translators: %s is the singular name of the post type.
|
|
311
|
-
'item_reverted_to_draft' => sprintf( __( '%s reverted to draft', 'chisel' ), $post_type_args['singular'] ),
|
|
312
|
-
// translators: %s is the singular name of the post type.
|
|
313
|
-
'item_scheduled' => sprintf( __( '%s scheduled', 'chisel' ), $post_type_args['singular'] ),
|
|
314
|
-
// translators: %s is the singular name of the post type.
|
|
315
|
-
'item_updated' => sprintf( __( '%s updated', 'chisel' ), $post_type_args['singular'] ),
|
|
316
|
-
// translators: %s is the singular name of the post type.
|
|
317
|
-
'item_trashed' => sprintf( __( '%s trashed', 'chisel' ), $post_type_args['singular'] ),
|
|
318
|
-
// translators: %s is the singular name of the post type.
|
|
319
|
-
'item_untrashed' => sprintf( __( '%s untrashed', 'chisel' ), $post_type_args['singular'] ),
|
|
320
|
-
// translators: %s is the singular name of the post type.
|
|
321
|
-
'item_link' => sprintf( __( '%s link', 'chisel' ), $post_type_args['singular'] ),
|
|
322
|
-
// translators: %s is the singular name of the post type.
|
|
323
|
-
'item_link_description' => sprintf( __( 'A link to a %s', 'chisel' ), $post_type_args['singular'] ),
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
$custom_labels = isset( $post_type_args['labels'] ) ? $post_type_args['labels'] : array();
|
|
327
|
-
|
|
328
|
-
return wp_parse_args( $custom_labels, $labels );
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Get taxonomy labels.
|
|
333
|
-
*
|
|
334
|
-
* @param array $taxonomy_args Taxonomy.
|
|
335
|
-
*
|
|
336
|
-
* @return array
|
|
337
|
-
*/
|
|
338
|
-
protected function get_taxonomy_labels( $taxonomy_args ) {
|
|
339
|
-
$labels = array(
|
|
340
|
-
'name' => $taxonomy_args['plural'],
|
|
341
|
-
'singular_name' => $taxonomy_args['singular'],
|
|
342
|
-
// translators: %s is the plural name of the taxonomy.
|
|
343
|
-
'search_items' => sprintf( __( 'Search %s', 'chisel' ), $taxonomy_args['plural'] ),
|
|
344
|
-
// translators: %s is the plural name of the taxonomy.
|
|
345
|
-
'popular_items' => sprintf( __( 'Popular %s', 'chisel' ), $taxonomy_args['plural'] ),
|
|
346
|
-
// translators: %s is the plural name of the taxonomy.
|
|
347
|
-
'all_items' => sprintf( __( 'All %s', 'chisel' ), $taxonomy_args['plural'] ),
|
|
348
|
-
// translators: %s is the singular name of the taxonomy.
|
|
349
|
-
'parent_item' => sprintf( __( 'Parent %s', 'chisel' ), $taxonomy_args['singular'] ),
|
|
350
|
-
// translators: %s is the singular name of the taxonomy.
|
|
351
|
-
'parent_item_colon' => sprintf( __( 'Parent %s:', 'chisel' ), $taxonomy_args['singular'] ),
|
|
352
|
-
// translators: %s is the singular name of the taxonomy.
|
|
353
|
-
'edit_item' => sprintf( __( 'Edit %s', 'chisel' ), $taxonomy_args['singular'] ),
|
|
354
|
-
// translators: %s is the singular name of the taxonomy.
|
|
355
|
-
'view_item' => sprintf( __( 'View %s', 'chisel' ), $taxonomy_args['singular'] ),
|
|
356
|
-
// translators: %s is the singular name of the taxonomy.
|
|
357
|
-
'update_item' => sprintf( __( 'Update %s', 'chisel' ), $taxonomy_args['singular'] ),
|
|
358
|
-
// translators: %s is the singular name of the taxonomy.
|
|
359
|
-
'add_new_item' => sprintf( __( 'Add New %s', 'chisel' ), $taxonomy_args['singular'] ),
|
|
360
|
-
// translators: %s is the singular name of the taxonomy.
|
|
361
|
-
'new_item_name' => sprintf( __( 'New %s Name', 'chisel' ), $taxonomy_args['singular'] ),
|
|
362
|
-
// translators: %s is the plural name of the taxonomy.
|
|
363
|
-
'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'chisel' ), $taxonomy_args['plural'] ),
|
|
364
|
-
// translators: %s is the plural name of the taxonomy.
|
|
365
|
-
'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'chisel' ), $taxonomy_args['plural'] ),
|
|
366
|
-
// translators: %s is the plural name of the taxonomy.
|
|
367
|
-
'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'chisel' ), $taxonomy_args['plural'] ),
|
|
368
|
-
// translators: %s is the plural name of the taxonomy.
|
|
369
|
-
'not_found' => sprintf( __( 'No %s found', 'chisel' ), $taxonomy_args['plural'] ),
|
|
370
|
-
'no_terms' => __( 'No terms', 'chisel' ),
|
|
371
|
-
// translators: %s is the singular name of the taxonomy.
|
|
372
|
-
'filter_by_item' => sprintf( __( 'Filter by %s', 'chisel' ), $taxonomy_args['singular'] ),
|
|
373
|
-
// translators: %s is the plural name of the taxonomy.
|
|
374
|
-
'items_list_navigation' => sprintf( __( '%s list navigation', 'chisel' ), $taxonomy_args['plural'] ),
|
|
375
|
-
// translators: %s is the plural name of the taxonomy.
|
|
376
|
-
'items_list' => sprintf( __( '%s list', 'chisel' ), $taxonomy_args['plural'] ),
|
|
377
|
-
'most_used' => _x( 'Most Used', 'taxonomy', 'chisel' ),
|
|
378
|
-
// translators: %s is the plural name of the taxonomy.
|
|
379
|
-
'back_to_items' => sprintf( __( '← Back to %s', 'chisel' ), $taxonomy_args['plural'] ),
|
|
380
|
-
// translators: %s is the singular name of the taxonomy.
|
|
381
|
-
'item_link' => sprintf( __( '%s link', 'chisel' ), $taxonomy_args['singular'] ),
|
|
382
|
-
// translators: %s is the singular name of the taxonomy.
|
|
383
|
-
'item_link_description' => sprintf( __( 'A link to a %s', 'chisel' ), $taxonomy_args['singular'] ),
|
|
384
|
-
);
|
|
385
|
-
|
|
386
|
-
$custom_labels = isset( $taxonomy_args['labels'] ) ? $taxonomy_args['labels'] : array();
|
|
387
|
-
|
|
388
|
-
return wp_parse_args( $custom_labels, $labels );
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Set custom post types.
|
|
393
|
-
*/
|
|
394
|
-
protected function set_post_types() {
|
|
395
|
-
$this->post_types = array(
|
|
396
|
-
// phpcs:disable
|
|
397
|
-
// 'chisel-cpt' => array(
|
|
398
|
-
// 'singular' => __( 'Chisel CPT', 'chisel' ),
|
|
399
|
-
// 'plural' => __( 'Chisel CPTs', 'chisel' ),
|
|
400
|
-
// 'supports' => array( 'editor', 'thumbnail', 'excerpt' ),
|
|
401
|
-
// 'menu_icon' => 'location-alt',
|
|
402
|
-
// 'hierarchical' => true,
|
|
403
|
-
// 'public' => true,
|
|
404
|
-
// 'menu_position' => 20,
|
|
405
|
-
// 'rewrite' => array(
|
|
406
|
-
// 'slug' => 'chisel-post',
|
|
407
|
-
// ),
|
|
408
|
-
// ),
|
|
409
|
-
// phpcs:enable
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Set custom taxonomies.
|
|
415
|
-
*/
|
|
416
|
-
protected function set_taxonomies() {
|
|
417
|
-
$this->taxonomies = array(
|
|
418
|
-
// phpcs:disable
|
|
419
|
-
// 'chisel-tax' => array(
|
|
420
|
-
// 'singular' => __( 'Chisel Tax', 'chisel' ),
|
|
421
|
-
// 'plural' => __( 'Chisel Taxes', 'chisel' ),
|
|
422
|
-
// 'post_types' => array( 'chisel-cpt' ),
|
|
423
|
-
// 'public' => true,
|
|
424
|
-
// 'rewrite' => array(
|
|
425
|
-
// 'slug' => 'chisel-category',
|
|
426
|
-
// ),
|
|
427
|
-
// ),
|
|
428
|
-
// phpcs:enable
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Get the instance of the class.
|
|
434
|
-
*/
|
|
435
|
-
public static function get_instance() {
|
|
436
|
-
static $instance = null;
|
|
437
|
-
|
|
438
|
-
if ( null === $instance ) {
|
|
439
|
-
$instance = new self();
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return $instance;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
namespace Chisel;
|
|
4
|
-
|
|
5
|
-
use Timber\Post as TimberPost;
|
|
6
|
-
use Timber\Timber;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Extend Timber Post class with custom functionality. This is a woocommerce product class.
|
|
10
|
-
*
|
|
11
|
-
* @package Chisel
|
|
12
|
-
*/
|
|
13
|
-
class ExtendedProduct extends TimberPost {
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Product thumbnail.
|
|
17
|
-
*
|
|
18
|
-
* @var html
|
|
19
|
-
*/
|
|
20
|
-
public $thumbnail_html;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get the product thumbnail. Returns the thumbnail responsive image html.
|
|
24
|
-
*
|
|
25
|
-
* @param string $size Thumbnail size.
|
|
26
|
-
* @return html
|
|
27
|
-
*/
|
|
28
|
-
public function get_thumbnail( $size = 'woocommerce_thumbnail' ) {
|
|
29
|
-
if ( ! $this->thumbnail_html ) {
|
|
30
|
-
$thumbnail_html = has_post_thumbnail( $this->ID ) ? Helpers::get_responsive_image( get_post_thumbnail_id( $this->ID ), $size ) : '';
|
|
31
|
-
|
|
32
|
-
if ( ! $thumbnail_html ) {
|
|
33
|
-
$thumbnail_html = wc_placeholder_img( $size );
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
$this->thumbnail_html = $thumbnail_html;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return $this->thumbnail_html;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
namespace Chisel;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Yoast SEO plugin related functionalities.
|
|
7
|
-
*
|
|
8
|
-
* @package Chisel
|
|
9
|
-
*/
|
|
10
|
-
class Yoast implements Instance {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Class constructor.
|
|
14
|
-
*/
|
|
15
|
-
private function __construct() {
|
|
16
|
-
if ( ! self::is_yoast_active() ) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
$this->set_properties();
|
|
21
|
-
$this->action_hooks();
|
|
22
|
-
$this->filter_hooks();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Set properties.
|
|
27
|
-
*/
|
|
28
|
-
public function set_properties() {}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Register action hooks.
|
|
32
|
-
*/
|
|
33
|
-
public function action_hooks() {}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Register filter hooks.
|
|
37
|
-
*/
|
|
38
|
-
public function filter_hooks() {}
|
|
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
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Check if Gravity Forms plugin is active.
|
|
59
|
-
*
|
|
60
|
-
* @return bool
|
|
61
|
-
*/
|
|
62
|
-
public static function is_yoast_active() {
|
|
63
|
-
return class_exists( '\WPSEO_Options' );
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Get the instance of the class.
|
|
68
|
-
*/
|
|
69
|
-
public static function get_instance() {
|
|
70
|
-
static $instance = null;
|
|
71
|
-
|
|
72
|
-
if ( null === $instance ) {
|
|
73
|
-
$instance = new self();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return $instance;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
class XfiveACFSync {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.modal = document.querySelector('.js-xfive-acf-sync-modal');
|
|
4
|
-
|
|
5
|
-
if (!this.modal) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
this.classnames = {
|
|
10
|
-
open: 'is-open',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
this.modalCloseButton = document.querySelector('.js-xfive-acf-sync-modal-close');
|
|
14
|
-
|
|
15
|
-
this.modalCloseHandler();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
modalCloseHandler() {
|
|
19
|
-
this.modalCloseButton.addEventListener('click', () => {
|
|
20
|
-
this.modal.classList.remove(this.classnames.open);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line no-new
|
|
26
|
-
new XfiveACFSync();
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/* ACF Sync module styles */
|
|
2
|
-
|
|
3
|
-
.xfive-acf-sync-modal {
|
|
4
|
-
position: fixed;
|
|
5
|
-
inset: 0;
|
|
6
|
-
z-index: 99999;
|
|
7
|
-
display: none;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
overflow: auto;
|
|
11
|
-
background-color: rgba(0, 0, 0, 50%);
|
|
12
|
-
|
|
13
|
-
&.is-open {
|
|
14
|
-
display: flex;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.xfive-acf-sync-modal__box {
|
|
19
|
-
width: 100%;
|
|
20
|
-
max-width: 500px;
|
|
21
|
-
padding: 16px;
|
|
22
|
-
margin-top: auto;
|
|
23
|
-
margin-bottom: auto;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.xfive-acf-sync-modal__content {
|
|
27
|
-
padding: 24px;
|
|
28
|
-
font-size: 20px;
|
|
29
|
-
line-height: 1.5;
|
|
30
|
-
text-align: center;
|
|
31
|
-
background-color: #fff;
|
|
32
|
-
border-radius: 8px;
|
|
33
|
-
box-shadow:
|
|
34
|
-
rgba(0, 0, 0, 0%) 0 0 0 0,
|
|
35
|
-
rgba(0, 0, 0, 0%) 0 0 0 0,
|
|
36
|
-
rgba(0, 0, 0, 10%) 0 1px 3px 0,
|
|
37
|
-
rgba(0, 0, 0, 10%) 0 1px 2px -1px;
|
|
38
|
-
|
|
39
|
-
h3 {
|
|
40
|
-
margin-bottom: 30px;
|
|
41
|
-
font-size: 18px !important;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.xfive-acf-sync-modal__actions {
|
|
46
|
-
display: grid;
|
|
47
|
-
grid-template-columns: repeat(3, 1fr);
|
|
48
|
-
gap: 16px;
|
|
49
|
-
|
|
50
|
-
a,
|
|
51
|
-
button {
|
|
52
|
-
justify-content: center;
|
|
53
|
-
font-size: 15px;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.xfive-acf-sync-modal__icon {
|
|
58
|
-
text-align: center;
|
|
59
|
-
|
|
60
|
-
svg {
|
|
61
|
-
width: 50px;
|
|
62
|
-
height: 50px;
|
|
63
|
-
}
|
|
64
|
-
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_icon.scss
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
@use '../../design/settings';
|
|
2
|
-
@use '~design' as *;
|
|
3
|
-
|
|
4
|
-
$_buttons-icons: settings.$buttons-icons;
|
|
5
|
-
|
|
6
|
-
.c-icon {
|
|
7
|
-
display: inline-block;
|
|
8
|
-
width: px-rem(24);
|
|
9
|
-
height: px-rem(24);
|
|
10
|
-
font-style: normal;
|
|
11
|
-
vertical-align: middle;
|
|
12
|
-
background-color: get-color('black');
|
|
13
|
-
|
|
14
|
-
@each $button-icon in $_buttons-icons {
|
|
15
|
-
&--#{$button-icon} {
|
|
16
|
-
@include get-icon($button-icon);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<i class="c-icon c-icon--{{ icon }}"></i>
|