+
{{ inner_blocks( inner ) }}
- {{ function( 'alert_banner_dismiss_button', id ) }}
+ {{ wpstarter_alertbanner_dismiss_button(id) }}
diff --git a/wp-content/themes/wp-starter/blocks/breadcrumbs/block.php b/wp-content/themes/wp-starter/blocks/breadcrumbs/block.php
index 077821d2..f924708e 100644
--- a/wp-content/themes/wp-starter/blocks/breadcrumbs/block.php
+++ b/wp-content/themes/wp-starter/blocks/breadcrumbs/block.php
@@ -31,10 +31,11 @@ function () {
/**
* Breadcrumbs Output
*
- * @param array $block_template
+ * @param ?array $block_template The block template array.
+ *
* @return void
*/
-function wpstarter_breadcrumbs( array|null $block_template = [] ): void {
+function wpstarter_breadcrumbs( ?array $block_template = [] ): void {
if ( function_exists( 'rank_math_the_breadcrumbs' ) ) {
rank_math_the_breadcrumbs();
return;
diff --git a/wp-content/themes/wp-starter/blocks/breadcrumbs/render.php b/wp-content/themes/wp-starter/blocks/breadcrumbs/render.php
index ed970746..d5c7d9f8 100644
--- a/wp-content/themes/wp-starter/blocks/breadcrumbs/render.php
+++ b/wp-content/themes/wp-starter/blocks/breadcrumbs/render.php
@@ -7,7 +7,8 @@
* @package WPStarter
*/
+$template = $block['template'] ?? []; // phpcs:ignore
?>
diff --git a/wp-content/themes/wp-starter/blocks/breadcrumbs/render.twig b/wp-content/themes/wp-starter/blocks/breadcrumbs/render.twig
index b02db3b8..c15a1649 100644
--- a/wp-content/themes/wp-starter/blocks/breadcrumbs/render.twig
+++ b/wp-content/themes/wp-starter/blocks/breadcrumbs/render.twig
@@ -2,6 +2,7 @@
Block: Breadcrumbs
#}
+{% set template = block.template ?? [] }
- {{ function( 'wpstarter_breadcrumbs', block.template ) }}
+ {{ function( 'wpstarter_breadcrumbs', template ) }}
diff --git a/wp-content/themes/wp-starter/blocks/image-caption/render.php b/wp-content/themes/wp-starter/blocks/image-caption/render.php
index c4537fd3..539c140f 100644
--- a/wp-content/themes/wp-starter/blocks/image-caption/render.php
+++ b/wp-content/themes/wp-starter/blocks/image-caption/render.php
@@ -7,7 +7,7 @@
* @package WPStarter
*/
-$inner = [
+$inner = [ // phpcs:ignore
'template' => $block['template'] ?? [],
'templateLock' => 'all',
];
diff --git a/wp-content/themes/wp-starter/blocks/navigation-container/render.php b/wp-content/themes/wp-starter/blocks/navigation-container/render.php
index 1eafe4a5..5a95ece1 100644
--- a/wp-content/themes/wp-starter/blocks/navigation-container/render.php
+++ b/wp-content/themes/wp-starter/blocks/navigation-container/render.php
@@ -7,12 +7,7 @@
* @package WPStarter
*/
-$attrs = [
- 'x-data="{menuIsOpen : false}"',
- 'x-trap="menuIsOpen"',
-];
-
-$allowed = [
+$allowed = [ // phpcs:ignore
'core/group',
'core/paragraph',
'core/site-logo',
@@ -23,16 +18,16 @@
'core/spacer',
'core/separator',
];
-
-$block_template = [
- [
- 'core/navigation',
- ],
-];
-$inner = [
- 'template' => $block_template,
+$inner = [ // phpcs:ignore
+ 'template' => $block['template'] ?? [],
'allowedBlocks' => $allowed,
];
+$attrs = []; // phpcs:ignore
+
+if ( ! is_admin() ) {
+ $attrs['x-data'] = '{menuIsOpen : false}'; // phpcs:ignore
+ $attrs['x-trap'] = 'menuIsOpen'; // phpcs:ignore
+}
?>
>
diff --git a/wp-content/themes/wp-starter/blocks/navigation-container/render.twig b/wp-content/themes/wp-starter/blocks/navigation-container/render.twig
index 9f9ff0af..f8146a06 100644
--- a/wp-content/themes/wp-starter/blocks/navigation-container/render.twig
+++ b/wp-content/themes/wp-starter/blocks/navigation-container/render.twig
@@ -1,11 +1,7 @@
{#
Block: Navigation Container
#}
-{% set template = [
- [
- 'core/navigation'
- ]
-] %}
+
{% set allowed = [
'core/group',
'core/paragraph',
@@ -18,10 +14,9 @@
'core/separator'
] %}
{% set inner = {
- template: template,
+ template: block.template ?? [],
allowedBlocks: allowed
} %}
-
{% set attrs = {} %}
{% if function('is_admin') == false %}
diff --git a/wp-content/themes/wp-starter/blocks/navigation-container/template.json b/wp-content/themes/wp-starter/blocks/navigation-container/template.json
new file mode 100644
index 00000000..3f704ba7
--- /dev/null
+++ b/wp-content/themes/wp-starter/blocks/navigation-container/template.json
@@ -0,0 +1,5 @@
+{
+ "template": [
+ [ "core/navigation" ]
+ ]
+}
diff --git a/wp-content/themes/wp-starter/blocks/video-player/block.php b/wp-content/themes/wp-starter/blocks/video-player/block.php
index d3523e3b..fa6cc71c 100644
--- a/wp-content/themes/wp-starter/blocks/video-player/block.php
+++ b/wp-content/themes/wp-starter/blocks/video-player/block.php
@@ -12,7 +12,7 @@ function () {
}
);
-// Enable the YT JSON API
+// Enable the YT JSON API.
add_filter(
'embed_oembed_html',
function ( string $code ): string {
@@ -25,18 +25,20 @@ function ( string $code ): string {
);
add_filter(
- 'vgtbt_button_icons',
+ 'vgtbt_block_icons',
function ( array $icons ): array {
- $block_dir = dirname( __FILE__ );
- $play_icon_path = $block_dir . '/images/video-play-button.svg';
+ $play_icon_path = __DIR__ . '/images/video-play-button.svg';
- return array_merge([
- 'video-play-button' => [
- 'label' => __( 'Video Play Button', 'wp-starter' ),
- 'icon' => file_get_contents( $play_icon_path ),
- 'defaultLeft' => false,
+ return array_merge(
+ [
+ 'video-play-button' => [
+ 'label' => __( 'Video Play Button', 'wp-starter' ),
+ 'icon' => file_get_contents( $play_icon_path ),
+ 'defaultLeft' => false,
+ ],
],
- ], $icons );
+ $icons
+ );
},
9
);
diff --git a/wp-content/themes/wp-starter/blocks/video-player/render.php b/wp-content/themes/wp-starter/blocks/video-player/render.php
index f6ebe26e..8ba2ca94 100644
--- a/wp-content/themes/wp-starter/blocks/video-player/render.php
+++ b/wp-content/themes/wp-starter/blocks/video-player/render.php
@@ -7,13 +7,17 @@
* @package WPStarter
*/
-$attrs = [];
-$inner = [
- 'template' => $block['template'] ?? [],
+$attrs = []; // phpcs:ignore
+$inner = [ // phpcs:ignore
+ 'template' => $block['template'] ?? [],
+ 'allowedBlocks' => [
+ 'core/cover',
+ 'core/embed',
+ ],
];
-if ( ! is_admin() ) {
- $attrs['x-data'] = 'playvideo';
+if ( ! is_admin() ) {
+ $attrs['x-data'] = 'playvideo'; // phpcs:ignore
}
?>
>
diff --git a/wp-content/themes/wp-starter/blocks/video-player/render.twig b/wp-content/themes/wp-starter/blocks/video-player/render.twig
index 37cfb81b..1e0a8918 100644
--- a/wp-content/themes/wp-starter/blocks/video-player/render.twig
+++ b/wp-content/themes/wp-starter/blocks/video-player/render.twig
@@ -2,18 +2,15 @@
Block: Video Player
#}
-{% set allowed = [
- 'core/cover',
- 'core/embed'
-] %}
-
+{% set attrs = {} %}
{% set inner = {
template: block.template ?? [],
- allowedBlocks: allowed
+ allowedBlocks: [
+ 'core/cover',
+ 'core/embed'
+ ]
} %}
-{% set attrs = {} %}
-
{% if function('is_admin') == false %}
{% set attrs = {
'x-data': 'playvideo',
diff --git a/wp-content/themes/wp-starter/composer.json b/wp-content/themes/wp-starter/composer.json
index d4cd2d66..f8e6e4a9 100644
--- a/wp-content/themes/wp-starter/composer.json
+++ b/wp-content/themes/wp-starter/composer.json
@@ -29,6 +29,8 @@
"squizlabs/php_codesniffer": "^3.11",
"timber/timber": "^2.3",
"viget/viget-blocks-toolkit": "^1.0",
+ "viget/viget-form-blocks": "^0.0.1",
+ "viget/viget-parts-kit": "^1.0",
"wpackagist-plugin/accessibility-checker": "^1.17",
"wpackagist-plugin/safe-svg": "^2.3",
"wpackagist-plugin/seo-by-rank-math": "^1.0",
diff --git a/wp-content/themes/wp-starter/composer.lock b/wp-content/themes/wp-starter/composer.lock
index f1a940a8..647a553f 100644
--- a/wp-content/themes/wp-starter/composer.lock
+++ b/wp-content/themes/wp-starter/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "87c8541027cb975d50ccb30daaa5a567",
+ "content-hash": "9cb1de6d0a61c67a963d39be6fce9509",
"packages": [
{
"name": "composer/installers",
@@ -1189,6 +1189,99 @@
},
"time": "2025-01-15T00:25:05+00:00"
},
+ {
+ "name": "viget/viget-form-blocks",
+ "version": "0.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/vigetlabs/viget-form-blocks.git",
+ "reference": "318220f4d366a029aacdf0c259f19bbac310d8f3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/vigetlabs/viget-form-blocks/zipball/318220f4d366a029aacdf0c259f19bbac310d8f3",
+ "reference": "318220f4d366a029aacdf0c259f19bbac310d8f3",
+ "shasum": ""
+ },
+ "require": {
+ "composer/installers": "*"
+ },
+ "type": "wordpress-plugin",
+ "autoload": {
+ "psr-4": {
+ "VigetFormBlocks\\": "classes/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Viget",
+ "homepage": "https://viget.com/"
+ }
+ ],
+ "description": "Create forms in Gutenberg with ACF Blocks by Viget.",
+ "homepage": "https://github.com/vigetlabs/viget-form-blocks",
+ "keywords": [
+ "Forms",
+ "editor",
+ "gutenberg",
+ "plugin",
+ "wordpress"
+ ],
+ "support": {
+ "issues": "https://github.com/vigetlabs/viget-form-blocks/issues",
+ "source": "https://github.com/vigetlabs/viget-form-blocks/tree/v0.0.1"
+ },
+ "time": "2025-01-22T23:15:04+00:00"
+ },
+ {
+ "name": "viget/viget-parts-kit",
+ "version": "v1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/vigetlabs/viget-parts-kit.git",
+ "reference": "0a556f1952c121dcf5756ad80debb1490ce1768c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/vigetlabs/viget-parts-kit/zipball/0a556f1952c121dcf5756ad80debb1490ce1768c",
+ "reference": "0a556f1952c121dcf5756ad80debb1490ce1768c",
+ "shasum": ""
+ },
+ "require": {
+ "composer/installers": "*"
+ },
+ "type": "wordpress-plugin",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Viget",
+ "homepage": "https://viget.com/"
+ }
+ ],
+ "description": "Component Parts Kit integration for WordPress made by Viget.",
+ "homepage": "https://github.com/vigetlabs/viget-parts-kit",
+ "keywords": [
+ "blocks",
+ "components",
+ "directory",
+ "editor",
+ "gutenberg",
+ "index",
+ "wordpress"
+ ],
+ "support": {
+ "issues": "https://github.com/vigetlabs/viget-parts-kit/issues",
+ "source": "https://github.com/vigetlabs/viget-parts-kit/tree/v1.0.1"
+ },
+ "time": "2025-01-22T23:17:36+00:00"
+ },
{
"name": "wpackagist-plugin/accessibility-checker",
"version": "1.17.0",
diff --git a/wp-content/themes/wp-starter/functions.php b/wp-content/themes/wp-starter/functions.php
index c52d9ccb..5f505cb4 100644
--- a/wp-content/themes/wp-starter/functions.php
+++ b/wp-content/themes/wp-starter/functions.php
@@ -5,6 +5,8 @@
* @package WPStarter
*/
+namespace WPStarter;
+
// Maybe Load Composer dependencies.
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
@@ -12,13 +14,13 @@
// Init Vite.
require_once get_stylesheet_directory() . '/inc/class-vite.php';
-if ( class_exists( 'Vite' ) ) {
+if ( class_exists( __NAMESPACE__ . '\Vite' ) ) {
new Vite();
}
// Maybe Initialize Timber.
-if ( class_exists( 'Timber\Timber' ) ) {
- Timber\Timber::init();
+if ( class_exists( '\Timber\Timber' ) ) {
+ \Timber\Timber::init();
}
// Block Functions.
diff --git a/wp-content/themes/wp-starter/inc/blocks.php b/wp-content/themes/wp-starter/inc/blocks.php
index 61c5097e..5f94f642 100644
--- a/wp-content/themes/wp-starter/inc/blocks.php
+++ b/wp-content/themes/wp-starter/inc/blocks.php
@@ -5,6 +5,8 @@
* @package WPStarter
*/
+namespace WPStarter;
+
// Add Components block Category.
add_filter(
'block_categories_all',
@@ -23,11 +25,11 @@ function ( array $categories ): array {
// Disable some of the default core blocks.
add_filter(
'allowed_block_types_all',
- function ( array|bool $allowed_block_types, WP_Block_Editor_Context $context ): array|bool {
+ function ( array|bool $allowed_block_types, \WP_Block_Editor_Context $context ): array|bool {
// TODO: Maybe filter by $context.
if ( ! is_array( $allowed_block_types ) ) {
- $allowed_block_types = array_keys( WP_Block_Type_Registry::get_instance()->get_all_registered() );
+ $allowed_block_types = array_keys( \WP_Block_Type_Registry::get_instance()->get_all_registered() );
}
$removed_blocks = [
diff --git a/wp-content/themes/wp-starter/inc/class-vite.php b/wp-content/themes/wp-starter/inc/class-vite.php
index e5518d6f..84592c94 100644
--- a/wp-content/themes/wp-starter/inc/class-vite.php
+++ b/wp-content/themes/wp-starter/inc/class-vite.php
@@ -1,63 +1,83 @@
site_url = get_site_url();
@@ -69,10 +89,10 @@ public function __construct() {
$this->env = getenv( 'ENVIRONMENT' );
- // set frontend css/js
+ // Set front-end CSS/JS.
$this->entries['default'] = 'main.js';
- // set editor css/js
+ // Set editor CSS/JS.
$this->entries['editor'] = 'main.js';
add_action( 'wp_head', [ $this, 'init' ], 100 );
@@ -82,7 +102,6 @@ public function __construct() {
function () {
$screen = get_current_screen();
if ( $screen->is_block_editor ) {
- // $this->init(); // This breaks the block editor styles.
$this->init( 'editor' );
}
}
@@ -110,7 +129,7 @@ public function init( string $entry = '' ): void {
$this->initialized = true;
/* Print Vite HTML tags */
- echo $this->vite( $this->get_entry( $entry ) );
+ echo $this->vite( $this->get_entry( $entry ) ); // phpcs:ignore
}
/**
@@ -165,10 +184,10 @@ public function vite( string $entry ) {
$scripts = [];
if ( ! $this->initialized ) {
- $scripts[] = "";
+ $scripts[] = ""; // phpcs:ignore
}
- $scripts[] = "";
+ $scripts[] = ""; // phpcs:ignore
return implode( PHP_EOL, $scripts );
}
@@ -198,7 +217,7 @@ private function js( string $entry ): string {
return '';
}
- return sprintf( '', esc_url( $url ) );
+ return sprintf( '', esc_url( $url ) ); // phpcs:ignore
}
/**
@@ -229,7 +248,7 @@ private function css( string $entry ): string {
$tags = '';
foreach ( $this->get_css( $entry ) as $url ) {
- $tags .= sprintf( '', esc_url( $url ) );
+ $tags .= sprintf( '', esc_url( $url ) ); // phpcs:ignore
}
return $tags;
@@ -265,13 +284,13 @@ function () {
return [];
}
- $content = file_get_contents( $manifest );
+ $contents = file_get_contents( $manifest );
- if ( ! $content ) {
- die( 'Error: The manifest.json file is empty.' );
+ if ( ! $contents ) {
+ die( esc_html__( 'Error: The manifest.json file is empty or doesn\'t exist.', 'wp-starter' ) );
}
- return json_decode( $content, true );
+ return json_decode( $contents, true );
}
/**
@@ -285,7 +304,7 @@ private function get_asset_url( string $entry ): string {
$manifest = $this->get_manifest();
if ( ! isset( $manifest[ $entry ] ) ) {
- die( "Could not find entry in manifest for $entry" );
+ die( esc_html__( 'Could not find entry in manifest for', 'wp-starter' ) . ' ' . esc_html( $entry ) );
}
return $this->dist_url . $manifest[ $entry ]['file'];
@@ -345,7 +364,7 @@ public function script_loader( string $tag, string $handle, string $src ): strin
return $tag;
}
- return sprintf( '', esc_url( $src ) );
+ return sprintf( '', esc_url( $src ) ); // phpcs:ignore
}
/**
diff --git a/wp-content/themes/wp-starter/inc/icons.php b/wp-content/themes/wp-starter/inc/icons.php
index 46d52428..7d7dd3f3 100644
--- a/wp-content/themes/wp-starter/inc/icons.php
+++ b/wp-content/themes/wp-starter/inc/icons.php
@@ -5,30 +5,34 @@
* @package WPStarter
*/
+namespace WPStarter;
+
/**
* Add custom icons to the button icons array.
* Place your custom icon(s) in the `src/images/icons` directory.
* Then add the icon(s) to the array, the key and label should be unique for each icon.
*/
-
add_filter(
- 'vgtbt_button_icons',
+ 'vgtbt_block_icons',
function ( array $icons ): array {
$icon_path = get_stylesheet_directory() . '/src/images/icons/';
- /* Remove unused default icons */
- // unset( $icons['wordpress'] );
+ /* Remove unused default icons. */
+ unset( $icons['wordpress'] );
- return array_merge([
- /* Custom Icons */
- /* Be sure icon fill color is set to `currentColor` */
- /*
- 'our-custom-icon' => [
- 'label' => __( 'your custom icon', 'wp-starter' ),
- 'icon' => file_get_contents( $icon_path . 'file-name.svg' ),
- 'defaultLeft' => false,
+ return array_merge(
+ [
+ // Add Custom Icons.
+ /* Be sure icon fill color is set to `currentColor`. */
+ /*
+ 'our-custom-icon' => [
+ 'label' => __( 'your custom icon', 'wp-starter' ),
+ 'icon' => file_get_contents( $icon_path . 'file-name.svg' ),
+ 'defaultLeft' => false,
+ ],
+ */
],
- */
- ], $icons );
+ $icons
+ );
}
);