Home>Support>custom widget won’t work

custom widget won’t work

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

Hello,

I wanted to add a custom widget to the PageBuilder and found this tutorial:
https://siteorigin.com/docs/widgets-bundle/getting-started/creating-a-widget/

I followed the instructions, but i don’t know what you mean with
Once you’ve done this, you’ll see your widget in the Plugins > SiteOrigin Widgets list, it can be activated and deactivated

My Steps:

I created a Folder ‘pagebuilder’ in my theme directory’
I created a Folder ‘icon-row-widget’ in the pagebuilder folder
I created the file ‘icon-row-widget.php’ in “pagebulder/icon-row-widget”

Code from icon-row-widget.php:

<?php

/*
Widget Name: Icon Row
Description: An example widget which displays 'Hello world!'.
Author: Me
Author URI: http://example.com
Widget URI: http://example.com/hello-world-widget-docs,
Video URI: http://example.com/hello-world-widget-video
*/

class Icon_Row_Widget extends SiteOrigin_Widget {

	function get_template_name($instance) {
		return '';
	}

	function get_style_name($instance) {
		return '';
	}

}

siteorigin_widget_register("icon-row-widget", __FILE__, "Icon_Row_Widget");

Function.php

function wbexample_add_widget_folders($folders){
    $folders[] = get_template_directory() . '/pagebuilder/';
    return $folders;
}
add_filter('siteorigin_widgets_widget_folders', 'wbexample_add_widget_folders');

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 5 months ago Alex S
    Hi, I Work Here

    Hi Mathis,

    Okay so the issue here is that siteorigin_widgets_widget_folders is used to tell SiteOrigin Page Builder a directory that contains widgets, not a widget directory. This means that you need to give your custom widget a directory inside the pagebuilder directory. For example, here’s an image of the correct directory structure:

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More