0
votes

I have started learning wordpress recently. I have started from version 5 with this new Gutenberg editor which introduced Blocks. I am little confused regarding difference between this new Blocks concept and old Widgets.

Starting with a Blocks: they appear on page creation and can be added to page, there is nice documentation on wordpress webpage: https://developer.wordpress.org/block-editor/tutorials/block-tutorial/ a lot of stuff related to new blocks.

Everything is fine, but Blocks can be added only to page content and not into areas like: sidebar, footer etc.

For changing content of sidebar,footer areas we need to access Appearance->Widgets area where we can add multiple widgets to specific areas. Also for new Gutenberd Page Builder there is section called widgets available but with less number of widgets than under Apperance->Widgets section.

Im totally confused. Could someone explain what is the difference betweemn Blocks and Widgets?

Why for areas like sidebar/footer we can add only widgets and editing footer is under Widgets menu?

Why only part of widgets are available for Gutenberg Page Editor

What should i do to create reusable code snippet(some html/css/js logic) to be reused on a page? Should i create a widget and somehow include it to widget section for Gutenberg or maybe i should create this new concept of Block? But i will not reuse my block in footer/sidebar section...

Are widgets something which will gonna die soon in wordpress world and will be totally replaced by Blocks? I remember that in previous version we were able to add widgets to page using some kind of shortcodes, so any widget we want? Is it still possible?.

I will appreciate any comments on that.

1

1 Answers

1
votes

The Block Editor is so far being used only to generate "content". In the world of WordPress, that normally very generic word has a very specific meaning: whatever is returned by the function the_content(). Usually it's simply all the text and media input on the edit page of a post or page, though that can be modified by filters. This content is entered either in the classic editor's text box or (now) in one or more Gutenberg Blocks.

Widgets, on the other hand, display content outside the main content, in widget areas that your theme has located outside the main content in headers, sidebars, footers, etc.

I suspect you already know much of this. As to your question about code snippets, the simplest way to re-use code is through WordPress shortcodes. Register your shortcodes in functions.php or in a plugin; enable them in your theme; then use them anywhere. There is now a shortcode Block, by the way, for placing recurring content into main content.