How To Create a New Widget

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000078432

Creating a custom widget can come in handy when adding completely new functionality that the software does not offer by default.

Creating the Widget

To create a new custom widget, go to Toolbox » Widget Manager and click the New Widget button:

Widget Manager with Toolbox » Widget Manager in the menu and the New Widget button outlined.

Then, in the New Widget popup:

  1. Enter a Widget Name. Each widget on the website needs a different name.
  2. Add the code in the tab for its language: HTML, CSS or Javascript.
  3. Optionally, choose a Type of widget below the code: Widget (Default) or Advertisement / Banner.
  4. Click Save. The widget is saved, opens in the widget editor, and is listed in the Custom Widgets table of the Widget Manager.

To close the popup without saving, click Cancel or press Esc. If anything was typed, a prompt asks before the changes are discarded.

Using the Widget

Once created, the custom widget can be used in two ways:

  • In a sidebar: open Toolbox » Sidebar Manager, edit the desired sidebar, search for the widget by name, and drag it into place. See Toolbox » Sidebar Manager.
  • Anywhere widgets are supported (web pages, other widgets, SEO templates): call it with its shortcode, using the widget's exact name:
Copy
[widget=Widget Name]

To copy a widget's shortcode, hover over its row in the Custom Widgets table and click the clipboard icon beside its name. In the widget editor, the Shortcode menu offers Copy Shortcode and PHP Shortcode.

The Custom Widgets table with the clipboard icon beside a widget's name outlined, used to copy its shortcode.