Skip to content

Commit

Permalink
Revert "Adds filter to control max number of posts in query block"
Browse files Browse the repository at this point in the history
  • Loading branch information
mogmarsh authored Sep 4, 2024
1 parent 080fc12 commit 90e57ec
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 4 additions & 0 deletions blocks/query/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
],
"type": "string"
},
"maxNumberOfPosts": {
"default": 10,
"type": "number"
},
"minNumberOfPosts": {
"default": 1,
"type": "number"
Expand Down
7 changes: 3 additions & 4 deletions blocks/query/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ interface Window {
allowedPostTypes: Array<string>;
allowedTaxonomies: Array<string>;
parselyAvailable: string,
maxPosts: number,
};
}

Expand All @@ -63,6 +62,7 @@ export default function Edit({
attributes: {
backfillPosts = [],
deduplication = 'inherit',
maxNumberOfPosts = 10,
minNumberOfPosts = 1,
numberOfPosts = 5,
offset = 0,
Expand All @@ -82,7 +82,6 @@ export default function Edit({
allowedPostTypes = [],
allowedTaxonomies = [],
parselyAvailable = 'false',
maxPosts = 10,
} = {},
} = (window as any as Window);

Expand Down Expand Up @@ -327,14 +326,14 @@ export default function Edit({
title={__('Setup', 'wp-curate')}
initialOpen
>
{minNumberOfPosts !== undefined && minNumberOfPosts !== maxPosts ? (
{minNumberOfPosts !== undefined && minNumberOfPosts !== maxNumberOfPosts ? (
<RangeControl
label={__('Number of Posts', 'wp-curate')}
help={__('The maximum number of posts to show.', 'wp-curate')}
value={numberOfPosts}
onChange={setNumberOfPosts}
min={minNumberOfPosts}
max={maxPosts}
max={maxNumberOfPosts}
/>
) : null}
<RangeControl
Expand Down
8 changes: 0 additions & 8 deletions blocks/query/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ function wp_curate_query_block_init(): void {
*/
$allowed_taxonomies = apply_filters( 'wp_curate_allowed_taxonomies', [ 'category', 'post_tag' ] );

/**
* Filter the maximum number of posts that can be displayed in the Query block.
*
* @param integer $max_posts The maximum number of posts to display.
*/
$max_posts = apply_filters( 'wp_curate_max_posts', 10 );

/**
* Filter whether to use Parsely.
*
Expand All @@ -63,7 +56,6 @@ function wp_curate_query_block_init(): void {
'allowedPostTypes' => $allowed_post_types,
'allowedTaxonomies' => $allowed_taxonomies,
'parselyAvailable' => $parsely_available ? 'true' : 'false',
'maxPosts' => $max_posts,
]
);
}
Expand Down
1 change: 1 addition & 0 deletions blocks/query/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ interface EditProps {
attributes: {
backfillPosts?: number[];
deduplication?: string;
maxNumberOfPosts?: number;
minNumberOfPosts?: number;
numberOfPosts?: number;
offset?: number;
Expand Down

0 comments on commit 90e57ec

Please sign in to comment.