1

I am a Joomla user and very new to wordpress. I've thought Widget was the equivalent of Module of Joomla, but it turns out quite different and I feel like its behavior varies from theme to theme, which adds to the complexity. Here are some questions:

  1. I see from the 2021 theme's footer-widget.php file

enter image description here

Is the function named dynamic_sidebar used to display widgets here? So although it is called dynamic_SIDEBAR I can actually use it to display a widget area any place in my theme?

  1. Also in this 2021 theme, if I put in a 4th widget in the footer area it will be in a new row. Where do I set this behavior(widgets per row) in the backend without having to do some custom CSS.

  2. Do we really need widget? I actually just build a website without having to touch any widget. It seems to me the visual composers(WPBakery) can take care of all my needs even if I want some parts of page has the same behavior with Joomla's module. So can someone tell me in what scenarios will widgets definitely come in handy?

3
  • I do not believe that Joomla modules have a direct equivalent in WordPress. You should discard this mental model and focus on what you want to achieve, not porting Joomla concepts. Modern WordPress is moving heavily towards using blocks in all aspects ( v5.8 will replace the current widgets user interface with a block based interface ).
    – Tom J Nowell
    Jul 6 '21 at 22:22
  • Otherwise, can you clarify what you specific question is? WPSE isn't a discussion forum so you need a single specific question that people can write a solution/answer using facts
    – Tom J Nowell
    Jul 6 '21 at 22:23
  • please one question per question Jul 7 '21 at 6:07
2

Widgets are contained in sidebars (not 100% correct, but good enough). A sidebar is an area in which placement of widgets can be managed in the admin. Widgets are realy an instance of a widget class and usually you can have several widgets of the same class in the same and different sidebars.

You can define and register the code for the widget's admin and front end HTML if you want to add new types of widgets.

You need to register sidebars so wordpress (admin and front end) will be able to associate widgets with specific sidebars

A call to dynamic_sidebar will output the HTML for the widgets contained in the specified sidebar. Usually in a theme you will have a sidebar registration per each call of dynamic_sidebar but you don't have to do it if you don't need it.

2. Can't, unless the theme has some way to control such a behaviuor which most don't have. It is up to the user to place an ammount of widgets that make sense in each sidebar.

3. Page builders should be avoided as much as possible IMO, but this is actually a great example of the power of widgets. Assume you have a contact information that needs to be included as part of several pages. If you "hard code" the information in the HTML, when there will be a need to change the info, the user will need to hunt for all the pages in which it is located and manually change the information, while the inclusion of a widget (and I think all page builders let you insert a widget in the content) create automattically a centralised place in which the user can change the info.

Or in a more general way, widgets are useful tool to give the user power to control some aspects of the front end of the site. You don't need them if you are developing a 5 page site that is not ging to change, or if you are in any setting (corporate for example) in which a dedicate developer controls the behaviour of the site. In both cases it might be better to just code what ever needed in PHP and not give an option to the user to make mistakes.

2
  • Is there no telling where a widget will be appearing on a page? I expect a "position" for widgets from my Joomla mindset but there seems none and I can only guess where a widget appears from its name.
    – shenkwen
    Jul 8 '21 at 13:00
  • no, the positioning will be based on the location of the sidebar. Usually sidebar names inditade where they are located like "homepage footer" The exact location is harder to tell but usually this kind of description is good enough. You probably should get familiar with the customizer as its usage enable you to have more of WYIWYG control which is especially useful with widgets. Jul 8 '21 at 16:52
1

Every widget has a specific id when it registers in the theme. when it shows in the theme footer & sidebar then just call a function with id. like as .

in the default 2021 theme, there are no options to control widgets. some themes provide control widgets in the footer, sidebar. Users can set how many widgets need to show in the footer widget. also, change CSS which is shown in the screenshot.

if you want to use a widget then use it otherwise leave it. some awesome functionally easily provides widget. if you do not use widgets then use your page builder.

screenshot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.