I think the problem is simply this line:
'type' => 'option',
You should remove it, because the default is:
'type' => 'theme_mod',
since you want to use get_theme_mod()
.
You should also consider:
- prefixing these color settings slugs, to make them more unique.
- using for example:
'sanitize_callback' => 'sanitize_hex_color',
in your settings setup for sanitazion.
ps: there’s some piece missing from your code snippet.
Edit by Otto: The above answer is correct. Additionally:
-
When you do
get_theme_mod('primary_color')
, you should also specify the default value there, like so:get_theme_mod('primary_color', '#88C34B')
. This will prevent it from outputting broken CSS when the user has not selected a color in the customizer yet. -
Prefixing the slugs is not actually necessary for theme-mod settings, because they are stored uniquely to the theme in any case. If you were using options and not theme-mods, then prefixing would be desirable.