theme customizer – Grabing default from cuztomizer php file instead of other php script

Question

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!

0
Angel Hess 4 months 2022-04-10T07:36:59-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse