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.

My custom widget won’t activate

8 years ago

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.

Need fast email support? Get SiteOrigin Premium

Have a different question or issue?

Start New Thread