Last active
February 11, 2016 01:20
-
-
Save jonathanbardo/b837ef296d9883eff2d8 to your computer and use it in GitHub Desktop.
Override/Extends a plugin
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: Extend a plugin | |
* Version: 0.0.1 | |
* Author: Jonathan Bardo | |
* License: GPLv2+ | |
* Author URI: http://jonathanbardo.com | |
*/ | |
if ( ! class_exists( 'Date_Range_Filter' ) ) { | |
require plugin_dir_path( __FILE__ ) . '../date-range-filter/date-range-filter.php'; | |
} | |
class Test extends Date_Range_Filter { | |
public static function setup() { | |
parent::setup(); // optionnal | |
} | |
public static function OVERRIDE_PARENT_FUNCTION() { | |
// Isn't that beautiful? | |
} | |
} | |
remove_action( 'plugins_loaded', array( 'Date_Range_Filter', 'setup' ) ); | |
add_action( 'plugins_loaded', array( 'Test', 'setup' ), 20 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment