wpsmith / genesis-sandbox-featured-content-widget

Genesis Sandbox Featured Content Widget. Based on Nick Croft's Genesis Featured Widget Amplified for additional functionality which allows support for custom post types, taxonomies, and extends the flexibility of the widget via action hooks to allow the elements to be re-positioned or other elements to be added.
39 stars 21 forks source link

Fatal Error when not using Genesis #37

Open ebillias opened 10 years ago

ebillias commented 10 years ago

receive the following error when trying to access one of my multisite sites which does not have a Genesis theme:

Fatal error: Call to undefined function genesis_get_option() in /home/public_html/wp-content/plugins/genesis-featured-content-widget/gs-featured-content-widget.php on line 86

Cannot access site unless I disable the plugin....surely the plugin should check if Genesis is active before continuing?

jalberts commented 10 years ago

Hrm. It does perform the check in the main an old(?) initialization function, and should disable the plugin if Genesis isn't loaded or is not at least version 2.0.

That function is actually never called though, on closer inspection. The plugin initialization is handled on the genesis_init hook at 60.

That hook doesn't exist without Genesis being present though. So the other add_actions outside of gsfc_init() still run (76 and 111). The add_filter at 93 could be a problem, too, though probably not, given what it's doing.

76 is where the problem you're seeing is starting.

All of the initialization should be contained in one function that runs on genesis_init. The text domain declaration should fall under that, too, along with the add_filter. It could all happen in the function, or require_once call an initialization file.