This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

custom widget won’t work

8 years ago · Last reply by Alex S 8 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

1
  1. Alex S Staff 8 years, 29 days ago

    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.

Have a different question or issue?

Start New Thread