When working with widgets, you may come across auto placement options to help you automatically install widget.
Even though it may not always work for every themes, using auto placement can greatly simplify the process of setting up widgets. There are a few things to note when working with auto placement.
How to identify auto placed widgets?
Auto placed widgets will be denoted with
Here's how an auto placed widget look.
How a custom placed widget look
It is important not to remove
data-placement-mode="auto" attribute for auto placed widgets because that's how OnVoard identify auto placed snippets. When you set a widget to inactive or delete it, OnVoard will use this signature to automatically remove it from your site.
How will OnVoard automatically remove snippet?
Below are cases where OnVoard will automatically remove snippet.
- When auto placement widget is set to inactive or deleted.
- When auto placement widget switches to custom placement.
Below are cases where OnVoard will not automatically remove snippet.
- When custom placement widget is created/updated/deleted.
- When custom placement widget switches to auto placement.
In summary, auto installation and removal only happens for auto placed widgets. This is by design so that we don't accidentally remove any scripts that is manually installed by you. The code used for custom placement widgets will be treated like other code in your theme.
What if another same widget already exists in page?
- If the existing widget uses custom placement, OnVoard will still automatically install auto placement widget.
- If the existing widget uses auto placement, OnVoard will skip auto installation to prevent duplicate widgets.