Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CPT selector to Latest Posts #20831

Closed
wants to merge 2 commits into from

Conversation

Ringish
Copy link
Contributor

@Ringish Ringish commented Mar 12, 2020

Description

Adds a post type selector to the LatestPosts (in the QueryControls) block as described at #9013 and mentioned in #20046.

How has this been tested?

I've tested a few different scenarios where you would choose specific post types in the LatestPosts block.

Screenshots

Skärminspelning-2020-03-12-kl -14 23 38

Types of changes

New feature

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@Ringish Ringish changed the title Add CPT selector tp Latest Posts Add CPT selector to Latest Posts Mar 12, 2020
Copy link
Contributor

@draganescu draganescu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. The only major change is that json file that got entirely commited and maybe we should rename that category related variable in the other PR.

Testing locally I noticed all post types are shown, including system types, which should be hidden:

Screenshot 2020-03-13 at 08 29 56

Normally from that list only Posts and Pages are thing one would want to filter on.

"default":null
}
}
"name": "core/latest-posts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this file has been reformatted and for no good reason. We should revert this change to only include

 "postType": {
   "type": "string"
 },

It's probably an editor spaces setting issue :)

} = attributes;
const suggestions = categoriesList.reduce(
const categorySuggestions = categoriesList.reduce(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you changed this here from my comment in the other PR right?

@@ -254,10 +274,11 @@ class LatestPostsEdit extends Component {
value: item.name || item.value,
} ) )
}
suggestions={ Object.keys( suggestions ) }
suggestions={ Object.keys( categorySuggestions ) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, this is from the other PR. if we change in both places we might end up with conflicts 😁

@draganescu
Copy link
Contributor

Trac is also showing a linter issue here:

gutenberg/packages/block-library/src/latest-posts/edit.js
[0]   471:38  error  'getPostTypes' is assigned a value but never used  no-unused-vars

If you setup ESLint in VSCode these will be caught by the editor. Also Gutenberg has some git pre-commit hooks that catch these before the commit, I wonder why they don't run for you.

@ntsekouras
Copy link
Contributor

ntsekouras commented Aug 24, 2020

Hey @Ringish. Thanks for all the work you've done so far in this PR! Do you think you'll find some time to wrap it up in the next two weeks? If not, then I will probably try to work on it so that the enhancement of query related functionality isn’t delayed.

@paaljoachim
Copy link
Contributor

How is this PR coming along?

Order of controls should probably go like this.
User selects the Post Type.
Then category (or multiple) based on the Post Type selected above.
Then tags (if the user wants to add these in).
Order by
Number of posts to show (or all)

Screen Shot 2020-11-01 at 16 58 59

Screenshot from https://wordpress.org/plugins/flex-posts/

@ntsekouras
Copy link
Contributor

Hey @paaljoachim - I think the focus has shifted towards making this block a Query block variation, which now has support for CPTs (the block has more work enqueued). Check this issue here: #26193

@draganescu
Copy link
Contributor

I would close this PR as it will be irrelevant even if it's finalized.

@paaljoachim
Copy link
Contributor

Closing this PR based on above comments by Andrei @draganescu and Nik @ntsekouras
The Add Posts List block will become a variation of the Query block. The issue for that is here: #26193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants