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.

Adding and Developing My Own Widgets to Widgets Bundle

11 years ago · Last reply by Matt Le 11 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

12
  1. Greg Priday Staff 11 years, 3 months ago

    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. Matt Le 11 years, 3 months ago

    Ah ok thank you!

  3. Matt Le 11 years, 3 months ago

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

  4. Andrew Misplon Staff 11 years, 3 months ago

    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. Matt Le 11 years, 3 months ago

    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. Andrew Misplon Staff 11 years, 3 months ago

    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. Matt Le 11 years, 3 months ago

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

  8. Andrew Misplon Staff 11 years, 3 months ago

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

  9. Matt Le 11 years, 2 months ago

    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. Matt Le 11 years, 2 months ago

    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. Matt Le 11 years, 2 months ago

    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. Matt Le 11 years, 2 months ago

    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.

Have a different question or issue?

Start New Thread