I need a little help getting my head around passing instance variable to a hook.
I am reading the CSS files I need in my template dynamically and storing them in a $settings
object that I am keeping inside the scope of my plugin namespace.
So I want to do something like this:
add_action( 'wp_enqueue_scripts',function() {
\mynamespace\ScriptQueuer::QueueCss($settings->GetCss());
} );
but obviously I need to pass the $settings->GetCss()
return value into the scope somehow.
Do I make my $settings
object global somehow? I am not sure how to do that and also not sure its the best approach. Is there anyway to achieve this or do I have to have all the CSS files hardcoded in a static function?
function() use ( $settings ) {
? – toscho♦ yesterday