Skip to content

Instantly share code, notes, and snippets.

@jonathanbardo
Last active February 11, 2016 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jonathanbardo/b837ef296d9883eff2d8 to your computer and use it in GitHub Desktop.
Save jonathanbardo/b837ef296d9883eff2d8 to your computer and use it in GitHub Desktop.
Override/Extends a plugin
<?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