Class Layers_Widget not found

Asked on August 5, 2015 in Development.
Answered

Loving Layers. Very impressive.

I reviewed a reply from @Vail Joy  I believe the widget is initialized as he suggested. However, when the Layers theme is not activate, the Class “Layers_Widget” not found error is thrown. When the theme is activate, everything works as expected.

I know of methods to detect which theme is activate, but I am looking for the best recommended way to avoid this error. The method on the page above doesn’t seem to help.

Thank you

cliftonscott Developer
Reply
  • Possible Answers to Your Question:

  • 1 Answer(s)
    Answered on August 24, 2015. Best answer

    Layers widgets need Layers to be active, or for a child theme that defines layers as the parent template to be active. If you have a child theme, ensure it is setup properly (view our child theme guide in the main menu above) and ensure you are introducing widgets via a plugin, not a theme.

    To check for layers or a child theme from your Extension use wp_get_theme() to do this, which is a core hook. For child theme support you’re looking for the template value. It is best to return some kind of message or force the plugin to deactivate if Layers is not found.

    Vail Joy Layers Team
    Reply