From 71f3a7872aaf1854eb4cf85ee61b8328947754e0 Mon Sep 17 00:00:00 2001 From: Geoff Dusome Date: Wed, 26 Jun 2024 11:32:22 -0400 Subject: [PATCH 1/4] [MOOSE-132]: block binding files --- .../themes/core/bindings/Post_Permalink.php | 33 +++++++++++++ .../themes/core/bindings/Post_Type_Name.php | 44 +++++++++++++++++ .../core/bindings/Query_Results_Count.php | 49 +++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 wp-content/themes/core/bindings/Post_Permalink.php create mode 100644 wp-content/themes/core/bindings/Post_Type_Name.php create mode 100644 wp-content/themes/core/bindings/Query_Results_Count.php diff --git a/wp-content/themes/core/bindings/Post_Permalink.php b/wp-content/themes/core/bindings/Post_Permalink.php new file mode 100644 index 00000000..ca5b7870 --- /dev/null +++ b/wp-content/themes/core/bindings/Post_Permalink.php @@ -0,0 +1,33 @@ + +

Post Permalink Placeholder

+ + */ + + public function get_slug(): string { + return 'tribe/post-permalink'; + } + + public function get_args(): array { + return [ + Binding_Base::LABEL => __( 'Post Permalink', 'tribe' ), + Binding_Base::GET_VALUE_CALLBACK => [ $this, 'tribe_get_post_permalink' ], + ]; + } + + public function tribe_get_post_permalink(): string { + $post_permalink = get_the_permalink(); + + return esc_html( $post_permalink ); + } + +} diff --git a/wp-content/themes/core/bindings/Post_Type_Name.php b/wp-content/themes/core/bindings/Post_Type_Name.php new file mode 100644 index 00000000..169e0dbe --- /dev/null +++ b/wp-content/themes/core/bindings/Post_Type_Name.php @@ -0,0 +1,44 @@ + +

Post Type Name Placeholder

+ + */ + + public function get_slug(): string { + return 'tribe/post-type-name'; + } + + public function get_args(): array { + return [ + Binding_Base::LABEL => __( 'Post Type Name', 'tribe' ), + Binding_Base::GET_VALUE_CALLBACK => [ $this, 'tribe_get_post_type_name' ], + ]; + } + + public function tribe_get_post_type_name(): string { + // this gets us the post type, but we really want the name + $block_post_type = get_post_type(); + + if ( ! $block_post_type ) { + return ''; + } + + $post_object = get_post_type_object( $block_post_type ); + + if ( ! $post_object ) { + return ''; + } + + return esc_html__( $post_object->labels->singular_name, 'tribe' ); + } + +} diff --git a/wp-content/themes/core/bindings/Query_Results_Count.php b/wp-content/themes/core/bindings/Query_Results_Count.php new file mode 100644 index 00000000..21cde58d --- /dev/null +++ b/wp-content/themes/core/bindings/Query_Results_Count.php @@ -0,0 +1,49 @@ + +

Query Results Count Placeholder

+ + */ + + public function get_slug(): string { + return 'tribe/query-results-count'; + } + + public function get_args(): array { + return [ + Binding_Base::LABEL => __( 'Query Results Count', 'tribe' ), + Binding_Base::GET_VALUE_CALLBACK => [ $this, 'tribe_get_query_results_count' ], + ]; + } + + public function tribe_get_query_results_count(): string { + global $wp_query; + $is_search = is_search(); + $count = (int) $wp_query->found_posts; + $output = sprintf( _n( '%d result', '%d results', $count, 'tribe' ), number_format_i18n( $count ) ); + + if ( $is_search ) { + $output = sprintf( + _x( + '%s %s for “%s”', + 'First value is the number of results, second is word "result" (pluralized if necessary), third is the search term', + 'tribe' + ), + number_format_i18n( $count ), + _n( 'result', 'results', $count, 'tribe' ), + get_search_query() + ); + } + + return wp_kses_post( $output ); + } + +} From 4a5bf541cdb361f3c0fa44ef7097625886f71cc8 Mon Sep 17 00:00:00 2001 From: Geoff Dusome Date: Mon, 24 Jun 2024 15:30:24 -0400 Subject: [PATCH 2/4] [MOOSE-132]: [MOOSE-132]: try using block bindings api --- .../core/src/Blocks/Bindings/Binding_Base.php | 40 +++++++++ .../src/Blocks/Bindings/Binding_Interface.php | 16 ++++ .../src/Blocks/Bindings/Binding_Registrar.php | 15 ++++ .../core/src/Blocks/Blocks_Definer.php | 13 ++- .../core/src/Blocks/Blocks_Subscriber.php | 6 ++ .../core/assets/pcss/templates/search.pcss | 10 +++ wp-content/themes/core/assets/pcss/theme.pcss | 3 + .../blocks/tribe/post-permalink/block.json | 21 ----- .../core/blocks/tribe/post-permalink/edit.js | 32 ------- .../core/blocks/tribe/post-permalink/index.js | 60 ------------- .../blocks/tribe/post-permalink/render.php | 8 -- .../blocks/tribe/post-permalink/style.pcss | 12 --- .../blocks/tribe/post-type-name/block.json | 20 ----- .../core/blocks/tribe/post-type-name/edit.js | 32 ------- .../core/blocks/tribe/post-type-name/index.js | 66 --------------- .../blocks/tribe/post-type-name/render.php | 19 ----- .../blocks/tribe/post-type-name/style.pcss | 11 --- .../tribe/query-results-count/block.json | 22 ----- .../blocks/tribe/query-results-count/edit.js | 32 ------- .../blocks/tribe/query-results-count/index.js | 84 ------------------- .../tribe/query-results-count/render.php | 24 ------ .../tribe/query-results-count/style.pcss | 27 ------ .../core/patterns/card-post-search-result.php | 8 +- wp-content/themes/core/templates/search.html | 12 ++- 24 files changed, 115 insertions(+), 478 deletions(-) create mode 100644 wp-content/plugins/core/src/Blocks/Bindings/Binding_Base.php create mode 100644 wp-content/plugins/core/src/Blocks/Bindings/Binding_Interface.php create mode 100644 wp-content/plugins/core/src/Blocks/Bindings/Binding_Registrar.php create mode 100644 wp-content/themes/core/assets/pcss/templates/search.pcss delete mode 100644 wp-content/themes/core/blocks/tribe/post-permalink/block.json delete mode 100644 wp-content/themes/core/blocks/tribe/post-permalink/edit.js delete mode 100644 wp-content/themes/core/blocks/tribe/post-permalink/index.js delete mode 100644 wp-content/themes/core/blocks/tribe/post-permalink/render.php delete mode 100644 wp-content/themes/core/blocks/tribe/post-permalink/style.pcss delete mode 100644 wp-content/themes/core/blocks/tribe/post-type-name/block.json delete mode 100644 wp-content/themes/core/blocks/tribe/post-type-name/edit.js delete mode 100644 wp-content/themes/core/blocks/tribe/post-type-name/index.js delete mode 100644 wp-content/themes/core/blocks/tribe/post-type-name/render.php delete mode 100644 wp-content/themes/core/blocks/tribe/post-type-name/style.pcss delete mode 100644 wp-content/themes/core/blocks/tribe/query-results-count/block.json delete mode 100644 wp-content/themes/core/blocks/tribe/query-results-count/edit.js delete mode 100644 wp-content/themes/core/blocks/tribe/query-results-count/index.js delete mode 100644 wp-content/themes/core/blocks/tribe/query-results-count/render.php delete mode 100644 wp-content/themes/core/blocks/tribe/query-results-count/style.pcss diff --git a/wp-content/plugins/core/src/Blocks/Bindings/Binding_Base.php b/wp-content/plugins/core/src/Blocks/Bindings/Binding_Base.php new file mode 100644 index 00000000..c69b20ec --- /dev/null +++ b/wp-content/plugins/core/src/Blocks/Bindings/Binding_Base.php @@ -0,0 +1,40 @@ +get_args() as $key => $value ) { + if ( ! property_exists( $this, $key ) || $key === self::SLUG ) { + continue; + } + + $this->{$key} = $value; + } + } + + public function get_properties(): array { + return array_filter( [ + self::LABEL => $this->label, + self::GET_VALUE_CALLBACK => $this->get_value_callback, + self::USES_CONTEXT => $this->uses_context, + ] ); + } + +} diff --git a/wp-content/plugins/core/src/Blocks/Bindings/Binding_Interface.php b/wp-content/plugins/core/src/Blocks/Bindings/Binding_Interface.php new file mode 100644 index 00000000..d8dbee4d --- /dev/null +++ b/wp-content/plugins/core/src/Blocks/Bindings/Binding_Interface.php @@ -0,0 +1,16 @@ +get_slug(), $binding->get_properties() ); + } + +} diff --git a/wp-content/plugins/core/src/Blocks/Blocks_Definer.php b/wp-content/plugins/core/src/Blocks/Blocks_Definer.php index 7f7f180a..691458cf 100644 --- a/wp-content/plugins/core/src/Blocks/Blocks_Definer.php +++ b/wp-content/plugins/core/src/Blocks/Blocks_Definer.php @@ -7,6 +7,9 @@ use Tribe\Plugin\Blocks\Filters\Contracts\Filter_Factory; use Tribe\Plugin\Blocks\Filters\List_Filter; use Tribe\Plugin\Blocks\Filters\Paragraph_Filter; +use Tribe\Theme\bindings\Post_Permalink; +use Tribe\Theme\bindings\Post_Type_Name; +use Tribe\Theme\bindings\Query_Results_Count; use Tribe\Theme\blocks\core\button\Button; use Tribe\Theme\blocks\core\column\Column; use Tribe\Theme\blocks\core\columns\Columns; @@ -36,13 +39,11 @@ class Blocks_Definer implements Definer_Interface { public const CORE = 'blocks.core'; public const PATTERNS = 'blocks.patterns'; public const FILTERS = 'blocks.filters'; + public const BINDINGS = 'blocks.bindings'; public function define(): array { return [ self::TYPES => DI\add( [ - 'tribe/post-type-name', - 'tribe/post-permalink', - 'tribe/query-results-count', 'tribe/terms', ] ), @@ -78,6 +79,12 @@ public function define(): array { DI\get( List_Filter::class ), ] ), + self::BINDINGS => DI\add( [ + DI\get( Post_Permalink::class ), + DI\get( Post_Type_Name::class ), + DI\get( Query_Results_Count::class ), + ] ), + Filter_Factory::class => DI\autowire()->constructorParameter( 'filters', DI\get( self::FILTERS ) ), ]; } diff --git a/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php b/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php index 7c429e9f..1c168390 100644 --- a/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php +++ b/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php @@ -3,6 +3,7 @@ namespace Tribe\Plugin\Blocks; use Tribe\Libs\Container\Abstract_Subscriber; +use Tribe\Plugin\Blocks\Bindings\Binding_Registrar; use Tribe\Plugin\Blocks\Filters\Contracts\Filter_Factory; use Tribe\Plugin\Blocks\Patterns\Pattern_Category; use Tribe\Plugin\Blocks\Patterns\Pattern_Registrar; @@ -30,6 +31,11 @@ public function register(): void { foreach ( $this->container->get( Blocks_Definer::PATTERNS ) as $pattern ) { $this->container->get( Pattern_Registrar::class )->register( $pattern ); } + + // Register block bindings. + foreach ( $this->container->get( Blocks_Definer::BINDINGS ) as $binding ) { + $this->container->get( Binding_Registrar::class )->register( $binding ); + } }, 10, 0 ); /** diff --git a/wp-content/themes/core/assets/pcss/templates/search.pcss b/wp-content/themes/core/assets/pcss/templates/search.pcss new file mode 100644 index 00000000..4134b192 --- /dev/null +++ b/wp-content/themes/core/assets/pcss/templates/search.pcss @@ -0,0 +1,10 @@ +/* ------------------------------------------------------------------------- + * + * Templates: Search + * + * ------------------------------------------------------------------------- */ + +/* ported from query results count block (now using block bindings) */ +.search-no-results .tribe-query-results-count { + display: none; +} diff --git a/wp-content/themes/core/assets/pcss/theme.pcss b/wp-content/themes/core/assets/pcss/theme.pcss index b9b4ae5e..1d518c05 100644 --- a/wp-content/themes/core/assets/pcss/theme.pcss +++ b/wp-content/themes/core/assets/pcss/theme.pcss @@ -17,3 +17,6 @@ /* Patterns */ @import "cards/post.pcss"; @import "cards/post-search-result.pcss"; + +/* Templates */ +@import "templates/search.pcss"; diff --git a/wp-content/themes/core/blocks/tribe/post-permalink/block.json b/wp-content/themes/core/blocks/tribe/post-permalink/block.json deleted file mode 100644 index 3517a3c9..00000000 --- a/wp-content/themes/core/blocks/tribe/post-permalink/block.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 3, - "name": "tribe/post-permalink", - "version": "0.1.0", - "title": "Post Permalink", - "category": "theme", - "description": "Returns the post permalink as link text.", - "supports": { - "html": false, - "spacing": { - "margin": true, - "padding": true - } - }, - "textdomain": "tribe", - "editorScript": "file:./index.js", - "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php" -} diff --git a/wp-content/themes/core/blocks/tribe/post-permalink/edit.js b/wp-content/themes/core/blocks/tribe/post-permalink/edit.js deleted file mode 100644 index 378d50a1..00000000 --- a/wp-content/themes/core/blocks/tribe/post-permalink/edit.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * React hook that is used to mark the block wrapper element. - * It provides all the necessary props like the class name. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops - */ -import { useBlockProps } from '@wordpress/block-editor'; - -/** - * Server-side rendering of the block in the editor view - * - * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-server-side-render/ - */ -import ServerSideRender from '@wordpress/server-side-render'; - -/** - * The edit function describes the structure of your block in the context of the - * editor. This represents what the editor will render when the block is used. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit - * - * @return {Element} Element to render. - */ -export default function Edit() { - const blockProps = useBlockProps(); - - return ( -
- -
- ); -} diff --git a/wp-content/themes/core/blocks/tribe/post-permalink/index.js b/wp-content/themes/core/blocks/tribe/post-permalink/index.js deleted file mode 100644 index 1df126f2..00000000 --- a/wp-content/themes/core/blocks/tribe/post-permalink/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -import { registerBlockType } from '@wordpress/blocks'; - -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ -import './style.pcss'; - -/** - * Internal dependencies - */ -import Edit from './edit'; -import metadata from './block.json'; - -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -registerBlockType( metadata.name, { - ...metadata, - - icon: { - src: ( - - - - - - ), - }, - - /** - * @see ./edit.js - */ - edit: Edit, -} ); diff --git a/wp-content/themes/core/blocks/tribe/post-permalink/render.php b/wp-content/themes/core/blocks/tribe/post-permalink/render.php deleted file mode 100644 index 54c662c1..00000000 --- a/wp-content/themes/core/blocks/tribe/post-permalink/render.php +++ /dev/null @@ -1,8 +0,0 @@ - - -
> - -
diff --git a/wp-content/themes/core/blocks/tribe/post-permalink/style.pcss b/wp-content/themes/core/blocks/tribe/post-permalink/style.pcss deleted file mode 100644 index ad665a8b..00000000 --- a/wp-content/themes/core/blocks/tribe/post-permalink/style.pcss +++ /dev/null @@ -1,12 +0,0 @@ -/** - * The following styles get applied both on the front of your site - * and in the editor. - * - * Replace them with your own styles or remove the file completely. - */ - -.wp-block-tribe-post-permalink { - - @mixin t-caption; - color: var(--color-neutral-60); -} diff --git a/wp-content/themes/core/blocks/tribe/post-type-name/block.json b/wp-content/themes/core/blocks/tribe/post-type-name/block.json deleted file mode 100644 index ae2bc985..00000000 --- a/wp-content/themes/core/blocks/tribe/post-type-name/block.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 3, - "name": "tribe/post-type-name", - "version": "0.1.0", - "title": "Post Type Name", - "category": "theme", - "description": "Returns the post type name for a post object.", - "supports": { - "html": false, - "spacing": { - "margin": true, - "padding": true - } - }, - "textdomain": "tribe", - "editorScript": "file:./index.js", - "style": "file:./style-index.css", - "render": "file:./render.php" -} diff --git a/wp-content/themes/core/blocks/tribe/post-type-name/edit.js b/wp-content/themes/core/blocks/tribe/post-type-name/edit.js deleted file mode 100644 index 0fefe1bd..00000000 --- a/wp-content/themes/core/blocks/tribe/post-type-name/edit.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * React hook that is used to mark the block wrapper element. - * It provides all the necessary props like the class name. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops - */ -import { useBlockProps } from '@wordpress/block-editor'; - -/** - * Server-side rendering of the block in the editor view - * - * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-server-side-render/ - */ -import ServerSideRender from '@wordpress/server-side-render'; - -/** - * The edit function describes the structure of your block in the context of the - * editor. This represents what the editor will render when the block is used. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit - * - * @return {Element} Element to render. - */ -export default function Edit() { - const blockProps = useBlockProps(); - - return ( -
- -
- ); -} diff --git a/wp-content/themes/core/blocks/tribe/post-type-name/index.js b/wp-content/themes/core/blocks/tribe/post-type-name/index.js deleted file mode 100644 index c3057d8b..00000000 --- a/wp-content/themes/core/blocks/tribe/post-type-name/index.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -import { registerBlockType } from '@wordpress/blocks'; - -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ -import './style.pcss'; - -/** - * Internal dependencies - */ -import Edit from './edit'; -import metadata from './block.json'; - -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -registerBlockType( metadata.name, { - ...metadata, - - icon: { - src: ( - - - - - - ), - }, - - /** - * @see ./edit.js - */ - edit: Edit, -} ); diff --git a/wp-content/themes/core/blocks/tribe/post-type-name/render.php b/wp-content/themes/core/blocks/tribe/post-type-name/render.php deleted file mode 100644 index b264af85..00000000 --- a/wp-content/themes/core/blocks/tribe/post-type-name/render.php +++ /dev/null @@ -1,19 +0,0 @@ - - -
> - labels->singular_name, 'tribe' ); ?> -
diff --git a/wp-content/themes/core/blocks/tribe/post-type-name/style.pcss b/wp-content/themes/core/blocks/tribe/post-type-name/style.pcss deleted file mode 100644 index 25d23757..00000000 --- a/wp-content/themes/core/blocks/tribe/post-type-name/style.pcss +++ /dev/null @@ -1,11 +0,0 @@ -/** - * The following styles get applied both on the front of your site - * and in the editor. - * - * Replace them with your own styles or remove the file completely. - */ - -.wp-block-tribe-post-type-name { - - @mixin t-category; -} diff --git a/wp-content/themes/core/blocks/tribe/query-results-count/block.json b/wp-content/themes/core/blocks/tribe/query-results-count/block.json deleted file mode 100644 index 8d4a5807..00000000 --- a/wp-content/themes/core/blocks/tribe/query-results-count/block.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 3, - "name": "tribe/query-results-count", - "version": "0.1.0", - "title": "Query Results Count", - "category": "theme", - "description": "Displays (in context) the total number of posts in a archive", - "supports": { - "html": false, - "align": true, - "spacing": { - "margin": true, - "padding": true - } - }, - "textdomain": "tribe", - "editorScript": "file:./index.js", - "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "render": "file:./render.php" -} diff --git a/wp-content/themes/core/blocks/tribe/query-results-count/edit.js b/wp-content/themes/core/blocks/tribe/query-results-count/edit.js deleted file mode 100644 index 132de1fb..00000000 --- a/wp-content/themes/core/blocks/tribe/query-results-count/edit.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * React hook that is used to mark the block wrapper element. - * It provides all the necessary props like the class name. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops - */ -import { useBlockProps } from '@wordpress/block-editor'; - -/** - * Server-side rendering of the block in the editor view - * - * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-server-side-render/ - */ -import ServerSideRender from '@wordpress/server-side-render'; - -/** - * The edit function describes the structure of your block in the context of the - * editor. This represents what the editor will render when the block is used. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit - * - * @return {Element} Element to render. - */ -export default function Edit() { - const blockProps = useBlockProps(); - - return ( -
- -
- ); -} diff --git a/wp-content/themes/core/blocks/tribe/query-results-count/index.js b/wp-content/themes/core/blocks/tribe/query-results-count/index.js deleted file mode 100644 index 8388b5db..00000000 --- a/wp-content/themes/core/blocks/tribe/query-results-count/index.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -import { registerBlockType } from '@wordpress/blocks'; - -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ -import './style.pcss'; - -/** - * Internal dependencies - */ -import Edit from './edit'; -import metadata from './block.json'; - -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -registerBlockType( metadata.name, { - ...metadata, - - icon: { - src: ( - - - - - - - - - ), - }, - - /** - * @see ./edit.js - */ - edit: Edit, -} ); diff --git a/wp-content/themes/core/blocks/tribe/query-results-count/render.php b/wp-content/themes/core/blocks/tribe/query-results-count/render.php deleted file mode 100644 index 7c5aa99f..00000000 --- a/wp-content/themes/core/blocks/tribe/query-results-count/render.php +++ /dev/null @@ -1,24 +0,0 @@ -found_posts; -$output = sprintf( _n( '%d result', '%d results', $count, 'tribe' ), number_format_i18n( $count ) ); - -if ( $is_search ) { - $output = sprintf( - _x( - '%s %s for “%s”', - 'First value is the number of results, second is word "result" (pluralized if necessary), third is the search term', - 'tribe' - ), - number_format_i18n( $count ), - _n( 'result', 'results', $count, 'tribe' ), - get_search_query() - ); -} -?> - -
> -

-
diff --git a/wp-content/themes/core/blocks/tribe/query-results-count/style.pcss b/wp-content/themes/core/blocks/tribe/query-results-count/style.pcss deleted file mode 100644 index 4824d9ff..00000000 --- a/wp-content/themes/core/blocks/tribe/query-results-count/style.pcss +++ /dev/null @@ -1,27 +0,0 @@ -/** - * The following styles get applied both on the front of your site - * and in the editor. - * - * Replace them with your own styles or remove the file completely. - */ - -.wp-block-tribe-query-results-count { - - @mixin t-body; - - > p { - margin-top: 0; - } - - .search-term { - font-weight: 700; - } - - /** - * hide block if there are no search results - * only applies to search results template. - */ - .search-no-results & { - display: none; - } -} diff --git a/wp-content/themes/core/patterns/card-post-search-result.php b/wp-content/themes/core/patterns/card-post-search-result.php index 19de4357..2898c7c5 100644 --- a/wp-content/themes/core/patterns/card-post-search-result.php +++ b/wp-content/themes/core/patterns/card-post-search-result.php @@ -14,13 +14,17 @@
- + +

Post Type Name Placeholder

+ - + +

Post Permalink Placeholder

+
diff --git a/wp-content/themes/core/templates/search.html b/wp-content/themes/core/templates/search.html index b0515cab..9475d769 100644 --- a/wp-content/themes/core/templates/search.html +++ b/wp-content/themes/core/templates/search.html @@ -8,20 +8,26 @@

- + +

Query Results Count Placeholder

+
- + +

Post Type Name Placeholder

+ - + +

Post Permalink Placeholder

+
From 9c1903cb1321ec1a01e8d7d07bab07b3c8ff58cd Mon Sep 17 00:00:00 2001 From: Geoff Dusome Date: Tue, 9 Jul 2024 11:12:58 -0400 Subject: [PATCH 3/4] [MOOSE-132]: make PR wp 6.6 dependent for better UI --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0dc7306c..0a42ff3d 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "@php -r \"file_exists('local-config.php') || copy('local-config-sample.php', 'local-config.php');\"", "@php -r \"file_exists('local-config.json') || copy('local-config-sample.json', 'local-config.json');\"" ], - "setup-wordpress": "./vendor/bin/wp core download --version=6.5.5 --skip-content --force", + "setup-wordpress": "./vendor/bin/wp core download --version=6.6-RC2 --skip-content --force", "update-db": "./vendor/bin/wp core update-db", "post-root-package-install": [ "@setup-repo" From 3108bf298b73807eb7fa37f4b546f55a821c6c9f Mon Sep 17 00:00:00 2001 From: Geoff Dusome Date: Tue, 6 Aug 2024 13:55:08 -0400 Subject: [PATCH 4/4] [MOOSE-132]: update binding placeholder content --- wp-content/themes/core/templates/search.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-content/themes/core/templates/search.html b/wp-content/themes/core/templates/search.html index 9475d769..9f1b0fde 100644 --- a/wp-content/themes/core/templates/search.html +++ b/wp-content/themes/core/templates/search.html @@ -9,7 +9,7 @@

-

Query Results Count Placeholder

+

99 results

@@ -18,7 +18,7 @@

-

Post Type Name Placeholder

+

Post

@@ -26,7 +26,7 @@

-

Post Permalink Placeholder

+

https://example.com/hello-world/