janwidmer / lzb-select-dynamic

lazy-blocks custom control to offer a dynamic select containing wordpress posts, pages or categories
5 stars 1 forks source link

Enable custom post types #1

Closed bhaustein closed 3 years ago

bhaustein commented 3 years ago

Hi there,

thank you for your great improvemnet to the Lazy Blocks WordPress plugin. But in our use case we need an control to select a post from a custom post type. Would you consider to extend your plugin to make this possible?

Kind regards!

Bastian

janwidmer commented 3 years ago

Hi Bastian,

The enhancement should not be that hard, I will look into it in the next few days..

BR Jan

bhaustein commented 3 years ago

Thank you very much! Let me know if there is anything I can do for you in return. I really appriciate everyone coding open source. Thx again!

janwidmer commented 3 years ago

Hey @bhaustein,

I extended the plugin like this (not published yet):

Lazy Block Constructor Page: image

When you choose Post as Radio Button Option, there is now an additional Dropdown. As the method getPostTypes (which I use in the code) returns all kind of types, I filter some out manually:

That leaves us with the following (custom) post types on my demo instance: image

Forms and Form Entries are from the installed form plugin, News Entry is a custom post type added by me.

When you choose nothing from the dropdown, it will just default to Post.

On an actual Page, it would then look like this: image

Would that work for you?

bhaustein commented 3 years ago

Hi Jan,

that seams to be perfectly what we need. Can we perhaps test it before you release it? Perhaps you push it to a branch other than master and we clone that and give you feedback?

Thank you very much again!

Bastian

Holen Sie sich Outlook für Android

janwidmer commented 3 years ago

Hey Bastian, I enhanced it even more and now it's also possible to select a custom taxonomy: image

It would be great if you could test it before releasing. As I already pushed everything to the main branch, you can either get it from there or use the zip file here (Plugin Built based on the last commit on main):

lzb-select-dynamic.zip

Let me know if it works BR Jan

bhaustein commented 3 years ago

Hi Jan,

we have tested the plugin in our project and it works perfectly fine. Our junior developer understood the functionality without any extra explanation, so also the UI seams to be intuitive.

We do not have custom taxonomies in our project jet, so I have no feedback for that part - sorry.

I had a look at the code changes and was really astonished to see that it was only jsx, no php code changes. Wow! But as I do not know react at all I can give you no feedback on your code - but it seams to be very clean and tidy.

Thank you again (... and again ,and again ... :- ) 👍

Bastian

janwidmer commented 3 years ago

Hey Bastian,

thanks for testing, cool that it works.. yeah right, the REST Api and the React of the Gutenberg Editor are quite powerful these days.. I will publish the new version today or tomorrow evening.

BR Jan

janwidmer commented 3 years ago

Released with Version 1.1.4, see https://wordpress.org/plugins/lzb-select-dynamic/