Recommended practice for widget class extension
-
Thanks for this simple to use plugin and for your blog post explaining clearly how to customize it through a class extension. I’ve worked with themes plenty but am less experienced with WP’s plugin architecture, and the simplicity of extending Simple Image Widget has encouraged me to dive in.
What is the best way (ie – future-proof) to create new widgets based on Simple Image Widget?
I have created a separate plugin and included the Simple_Image_Widget class like this:
require_once( plugin_dir_path( __FILE__ ) . '../simple-image-widget/class-simple-image-widget.php' );But is there a safer way to reference the plugin? If you change the folder name WP will break spectacularly. If I add my class into your plugin, the customizations will be overridden if my client updates your plugin (yes, I should perform the updates for them, but clients be clicky, ya know?).
Is there a standard or safe way to handle plugin dependencies. A bit of Google research suggests it’s a common problem, but I didn’t see any documentation on best practices.
The topic ‘Recommended practice for widget class extension’ is closed to new replies.