Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Extend the WP_Widget_Factory class by overloading the register method to allow for passing params
<?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);
}
}
@Nordli

This is exactly what I want to do, has 3 widgets which differ only by name, while everything else is equal. I tried your code and it seems to work, it's ok to steal it and use in my function.php without something goes wrong in wordpress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.