Skip to content

Commit

Permalink
Merge pull request #633 from tomusborne/release/1.5.4
Browse files Browse the repository at this point in the history
Release: 1.5.4
  • Loading branch information
tomusborne authored Jul 14, 2022
2 parents 4c2556e + 4c132ed commit 4e2531d
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/blocks.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-rich-text'), 'version' => '3165a297dd14b83555ea672f501a0ee1');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-rich-text'), 'version' => '014d85cef652b1076b830deafd78f166');
2 changes: 1 addition & 1 deletion dist/blocks.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generateblocks",
"version": "1.5.3",
"version": "1.5.4",
"private": true,
"description": "A small collection of lightweight WordPress blocks that can accomplish nearly anything.",
"author": "Tom Usborne",
Expand Down
4 changes: 2 additions & 2 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything.
* Author: Tom Usborne
* Author URI: https://tomusborne.com
* Version: 1.5.3
* Version: 1.5.4
* Requires at least: 5.9
* Requires PHP: 5.6
* License: GPL2+
Expand All @@ -19,7 +19,7 @@
exit; // Exit if accessed directly.
}

define( 'GENERATEBLOCKS_VERSION', '1.5.3' );
define( 'GENERATEBLOCKS_VERSION', '1.5.4' );
define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) );
define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) );

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: blocks, gutenberg, container, headline, grid, columns, page builder, wysiw
Requires at least: 5.9
Tested up to: 6.0
Requires PHP: 5.6
Stable tag: 1.5.3
Stable tag: 1.5.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -85,6 +85,9 @@ GenerateBlocks was built to work hand-in-hand with [GeneratePress](https://gener

== Changelog ==

= 1.5.4 =
* Fix: Non hierarchical taxonomies with broken REST API calls

= 1.5.3 =
* Feature: Added necessary filters for related posts
* Feature: Add option to include/exclude term children in query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export default function TaxonomyParameterControl( props ) {

const taxonomies = useTaxonomies();

const isHierarchical = useMemo( () => {
const tax = taxonomies.filter( ( record ) => ( record.slug === taxonomy ) );

return !! tax[ 0 ] ? tax[ 0 ].hierarchical : false;
}, [ JSON.stringify( taxonomies ), taxonomy ] );

useEffect( () => {
if ( value.taxonomy !== taxonomy ) {
setTaxonomy( value.taxonomy );
Expand All @@ -27,16 +33,22 @@ export default function TaxonomyParameterControl( props ) {
if ( !! taxonomy ) {
const tax = taxonomies.filter( ( record ) => ( record.slug === taxonomy ) );
const rest = !! tax[ 0 ] ? tax[ 0 ].rest_base : undefined;
const hierarchical = !! tax[ 0 ] ? tax[ 0 ].hierarchical : false;

onChange( { taxonomy, terms, rest, includeChildren } );
onChange( {
taxonomy,
terms,
rest,
includeChildren: hierarchical ? includeChildren : undefined,
} );
}
}, [ taxonomy, JSON.stringify( terms ), includeChildren ] );

const taxonomiesOptions = useMemo( () => (
taxonomies
.filter( ( tax ) => ( 'nav_menu' !== tax.slug ) )
.map( ( tax ) => ( { value: tax.slug, label: tax.name } ) )
), [ taxonomies ] );
), [ JSON.stringify( taxonomies ) ] );

const labelStyles = { marginBottom: '8px', display: 'inline-block' };

Expand Down Expand Up @@ -72,11 +84,13 @@ export default function TaxonomyParameterControl( props ) {
help={ terms.length === 0 ? __( 'You must select at least one term.', 'generateblocks' ) : '' }
/>

<ToggleControl
checked={ includeChildren }
label={ __( 'Include child terms', 'generateblocks' ) }
onChange={ setIncludeChildren }
/>
{ isHierarchical &&
<ToggleControl
checked={ includeChildren }
label={ __( 'Include child terms', 'generateblocks' ) }
onChange={ setIncludeChildren }
/>
}
</>
}
</>
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/query-loop/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function getTaxQueryParam( taxQuery, isExclude = false ) {
const paramKey = isExclude ? `${ taxQuery.rest }_exclude` : taxQuery.rest;
return { [ paramKey ]: {
terms: taxQuery.terms,
include_children: taxQuery.includeChildren,
include_children: taxQuery?.includeChildren,
} };
}

Expand Down

0 comments on commit 4e2531d

Please sign in to comment.