Answering the question on Quora: "How do I specify the loading order of plugins?" by changing the question to "How do you ensure that you declare your child class after the plugin's class is declared?" - http://www.quora.com/WordPress-Plugin-Development/How-do-I-specify-the-loading-order-of-plugins. Note I've boiled this example down to its bare…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* class_exists() is a fail-safe. | |
*/ | |
if ( ! class_exists( 'Parent_Class_Plugin' ) ) | |
return; | |
class Child_Class_Plugin extends Parent_Class_Plugin { | |
// Your plugin code goes here. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: @Child Plugin | |
*/ | |
add_action( 'plugins_loaded', 'child_class_plugin_loader' ); | |
function child_class_plugin_loader() { | |
include dirname( __FILE__ ) . '/child-class-plugin-loader.php'; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: @Parent Plugin | |
*/ | |
class Parent_Class_Plugin { | |
// Their plugin code went here. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment