Home>Support>My custom widget won’t activate

My custom widget won’t activate

Hi!

I’m following the instructions (https://siteorigin.com/docs/widgets-bundle/getting-started/creating-a-widget/) and trying to create a custom widget using the SiteOrigin framework.

I’m developing this into a theme and not as a plugin.

I have this in my functions.php :

function pr_widget_collection($folders){
    $folders[] = get_template_directory() . '/inc/widgets/';
    return $folders;
}
add_filter('siteorigin_widgets_widget_folders', 'pr_widget_collection');

which then finds my currently one and only widget file :

/*
Widget Name: Icon Link Widget
Description: Creates a stylish icon button
Author: Herman Aus
*/

class Icon_Link_Widget extends SiteOrigin_Widget { 
    function get_template_name($instance) {
        return '';
    }

    function get_style_name($instance) {
        return '';
    }
}
// Register the new widget
siteorigin_widget_register('pr-icon-link-widget', __FILE__, 'Icon_Link_Widget');

The widget shows up under Plugins -> SiteOrigin Widgets but in can be activated. If I click on activate, it shows it’s activated but if I reload the page, it’s deactive again.

Could someone help shed some light into why this is happening?

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

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More