mardi 28 juin 2016

Access get_option within a class

I wrote my own Plugin and i want to access my plugin options in a Config class. Here is an example of my code.

class Config {
private $var = get_option('option');

public function getMyOption () {
  return $this->var;
}
}

But i get this error :

parse error: syntax error, unexpected '(', expecting ',' or ';' in

The Problem here ist how can i use the option values in a class? Could somebody explain me, how i can access the get_option value in a class?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire