Skip to content

Commit

Permalink
Merge pull request #174 from alleyinteractive/feature/issue-173/autos…
Browse files Browse the repository at this point in the history
…elect-first-post-type-disabled-posts

Issue-173: autoselect post types if posts are not enabled
  • Loading branch information
mogmarsh authored Apr 25, 2024
2 parents 74cdca5 + 66524a1 commit 6647f07
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `WP Curate` will be documented in this file.

## 1.9.1 - 2024-04-25

- Bug Fix: Improve handling of default post types on the Query block.

## 1.9.0 - 2024-04-19

- Enhancement: Exclude current post in backfilled posts query.
Expand Down
4 changes: 1 addition & 3 deletions blocks/query/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"type": "number"
},
"postTypes": {
"default": [
"post"
],
"default": [],
"items": {
"type": "string"
},
Expand Down
6 changes: 5 additions & 1 deletion blocks/query/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function Edit({
numberOfPosts = 5,
offset = 0,
posts: manualPosts = [],
postTypes = ['post'],
postTypes = [],
searchTerm = '',
terms = {},
termRelations = {},
Expand All @@ -82,6 +82,10 @@ export default function Edit({
} = {},
} = (window as any as Window);

if (!postTypes.length) {
setAttributes({ postTypes: allowedPostTypes });
}

const andOrOptions = [
{
label: __('AND', 'wp-curate'),
Expand Down
2 changes: 1 addition & 1 deletion wp-curate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP Curate
* Plugin URI: https://github.com/alleyinteractive/wp-curate
* Description: Plugin to curate homepages and other landing pages
* Version: 1.9.0
* Version: 1.9.1
* Author: Alley Interactive
* Author URI: https://github.com/alleyinteractive/wp-curate
* Requires at least: 6.4
Expand Down

0 comments on commit 6647f07

Please sign in to comment.