Home>Support>Adding and Developing My Own Widgets to Widgets Bundle

Adding and Developing My Own Widgets to Widgets Bundle

I’d like to add my own widgets to the Widgets Bundle. I noticed that the individual widgets live inside the /widgets folder of the plugin. If I wanted to create my own widget so it’s integrated into the plugin, how would I do this and what are the best practices?

Thanks!

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

  1. 9 years, 10 months ago Greg Priday
    Hi, I Work Here

    Hi Matt

    There is some functionality in our development version of the widgets bundle to be able to add custom widget folders. Technically this functionality is in the current version, but it’s a bit buggy. It’d be best to wait for the 1.1 update which we’re hoping to push by the end of the month.

    This is how you’ll add custom folders.

    function so_widgets_experimental_add_folder($folders){
      $folders[] = plugin_dir_path(__FILE__).'widgets/';
      return $folders;
    }
    add_filter('siteorigin_widgets_widget_folders', 'so_widgets_experimental_add_folder');
    

    Creating an entire widget based on the framework is a slightly more complicated exercise though :)

  2. 9 years, 10 months ago Matt Le

    Ah ok thank you!

  3. 9 years, 10 months ago Matt Le

    Will the update include additional widgets? I guess for now, I can customize the plugin in my theme folder?

  4. 9 years, 9 months ago Andrew Misplon
    Hi, I Work Here

    Hi Matt

    There is a Google Maps widget on the way. I’m pretty sure it’ll be included in 1.1 but Greg will have to confirm that. At the moment that’s the only widget we have under development. More to follow though.

  5. 9 years, 9 months ago Matt Le

    Thanks! If I wanted to add a customized widget through SiteOrigin, is it more scalable to add it to the siteOrigins-panel/widgets or so-widgets-bundle/widgets ? I trying to copy some of the widgets you guys already made and modifying them for bootstrap compatibility. Perhaps I can contribute to the growing widgets to help others?

    Thanks !

  6. 9 years, 9 months ago Andrew Misplon
    Hi, I Work Here

    The next update of the Widget Bundle will make this easier. Then you’d create your own plugin with your widgets contained in that. For now you can run them from so-widgets-bundle/widgets. Just keep a backup as that’ll all get overwritten on update.

  7. 9 years, 9 months ago Matt Le

    Thanks you guys are awesome. Looking forward to the update then!

  8. 9 years, 9 months ago Andrew Misplon
    Hi, I Work Here

    For sure. We’ll progress onto developer documentation once it’s been out for a bit.

  9. 9 years, 9 months ago Matt Le

    Sorry I have another question about SO Widgets. I duplicated the SO CTA widget code and I’m trying to customize it for my application. I changed some obvious fields to differentiate it from the CTA widget but it’s not showing up in the registered WP widgets list (/widgets.php). What piece of code actually registers the unique widget?

    Thanks and I know you guys are coming out with an update soon but Just trying to do some basic stuff before the release.

  10. 9 years, 9 months ago Matt Le

    I was able to find where the wp_options stores what widgets are active or not and found that it’s not storing my particular widget when I click the toggle button. Here’s the value that’s being stored in the DB:

    289 siteorigin_widgets_active

    a:9:{s:23:”so-post-carousel-widget”;b:1;s:21:”so-price-table-widget”;b:1;s:23:”frontiers-slider-widget”;b:1;s:16:”so-button-widget”;b:1;s:15:”so-image-widget”;b:1;s:13:”so-cta-widget”;b:1;s:18:”so-features-widget”;b:1;s:21:”frontiers-hero-widget”;b:1;}

    Thanks for you help

  11. 9 years, 9 months ago Matt Le

    Got this error when deactivating and reactivating plugin:

    The plugin generated 1 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    Hope this helps. Thanks!

  12. 9 years, 9 months ago Matt Le

    I noticed that the $widget_id is stored in the DB. Is it just as simple as inserting a new record for the widget?

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