It might be a little odd question, but I’m new at developing WordPress Themes, and having some difficulty to know, when to use Widgets or Theme Mods in the Customizer on my custom-made theme for a company.

The reason I’m confused is because I previously have been working with two the other themes, where one of them where using Theme Mods and the other, Widgets to do practically the same thing. That would include adding/changing stuff like the logo in the header and info boxes on the front page containing both images and text.

I’ve including the structure of my front-page, to better illustrate what kind of elements I want to be able to change:

enter image description here

The red section is a selection og five handpicked customers of the
company.

The two boxes below are containing some information about the company.

The last grey section is the footer which contains three columns.

So which method is the best practice when I want to change the content of each elements. Theme mods or widgets?

1 Answer
1

In short: It depends.

Widget go into a widget area. But that also means that when you create a widget area any widget can be put there as well as any number of widgets. So if you’d make the logo a widget a user could put twenty different widgets in that spot, including stuff that doesn’t really make sense there and could break the layout. So generally speaking widgets are only well suited for generic content regions like e.g. sidebars.

When using the Customizer you have more control and can create a UI that defines clearer what is doable. For example you can let the user choose an image, but he can’t put e.g. a tag cloud widget there instead.

As a final note this whole question also has a historic aspect: Widgets have been in WP for a long time, the Customizer was only later created, partly to overcome the limitations widgets have.

Leave a Reply

Your email address will not be published. Required fields are marked *