theme customizer – Grabing default from cuztomizer php file instead of other php script
I’ve seen codes that use something like: $this->default;
I don’t know the logic for that style of code yet. To grab a default for spesific customizer control or from a configuration file instead of using a hard coded within another echo or similar.
For example,
I don’t want to write like this:
if (isset($yeah['cool_color'])) :
echo 'background:' . $yeah['menu_gradient'];
else :
echo 'background:#000000';
endif;
I want to write something like this:
if (isset($yeah['cool_color'])) :
echo 'background:' . $yeah['menu_gradient'];
else :
echo 'background:' . $this->customizer->this-control->default;
endif;
In the $this
line, what is the correct code method for writing that whole line and getting the default from a spesific customizer control?
Is there a php name for this type of code with the ->
marks? I don’t know but I’d like to know. Thanks!
Leave an answer