WPBP / WordPress-Plugin-Boilerplate-Powered

Wordpress Plugin Boilerplate but Powered with examples and a generator!
https://wpbp.github.io/
GNU General Public License v3.0
791 stars 114 forks source link

[Feature] document should contain all template default demo and explaination #241

Closed idhowardgj94 closed 8 months ago

idhowardgj94 commented 8 months ago

As title, seems this boilerplate is quite complex one, and very hard to get all the idea inside inside this boilerplate.

I suggest to add some demo about all default support functionality and explaination.

For example, I have really hard time to find out what content-demo template used to, and confuse about the demo category trying to showcase.

As a boilerplate, easy to let developer dive into code is important to me.

Mte90 commented 8 months ago

https://wpbp.github.io/ has a lot of information, what do you think is missing?

In your case, if you check the readme of the library you find more information https://github.com/WPBP/Template and it is the same of any library we integrated it.

idhowardgj94 commented 8 months ago

I think that it's a very complete and complex boilerplate, yet the wiki only contain some general idea.

Back to my case, I just want to install this boilerplate in my wordpress and see every show case. But just for the template part, I can't figure out how to make a show case to show the effect.

I've try to add some demo post type and and add a page contain query loop, yet I can't see the result for that template demo.

I'm newbie to wordpress, and I know I must do something incorrectly. But I think if there are more details about the show case, it will be very nice to new comer.

Mte90 commented 8 months ago

So the function as explained there https://github.com/WPBP/Template will use the plugin slug as a folder to look up in your theme, when the demo post type is loaded, if the page is isngle will look for a file content-demo.php. Otherwise will look for a templates folder in your plugin.

idhowardgj94 commented 8 months ago

hmm ok, maybe my issues is related to my wordpress environment.

Thx for your help.

idhowardgj94 commented 8 months ago

I figure it out, I'm create a regular page post type page with edit UI's query loop to generate a demo list (picture below)

圖片

so the in_the_loop() and is_singular('demo') both wont return true, and that if condition won't pass.

the root problem is that I'm unfamilar with wordpress.

and I can image how to use that part of code and why it's useful.

still think it should have a detail about how to setup the showcase, or at least add one more page to show the Template effect. I tink it will be firendly for wordpress dev newbie. But maybe it's too easy to seasoned wordpress programmer

Mte90 commented 8 months ago

So with gutenberg that code isn't executed, probably the filter template_include at all isn't used, so is normal that the code isn't executed. Instead if you use a usual wordpress theme (archive page) the code is executed.

To change that you need to change the block https://make.wordpress.org/core/2022/10/10/extending-the-query-loop-block/