public

Extend the WP_Widget_Factory class by overloading the register method to allow for passing params

  • Download Gist
extend_wp_widget_factory.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?php
 
/*
*
* Extends the WP_Widget_Factory class by overloading the register method to allow for passing params
*
*/
 
Class Extend_WP_Widget_Factory extends WP_Widget_Factory {
 
// Overload register($widget_class) with ability to pass parameters into widgets
function register($widget_class, $param = null) {
$this->widgets[$widget_class] = new $widget_class($param);
}
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.