Skip to content

Instantly share code, notes, and snippets.

@frontend-coder
Last active June 2, 2022 12:34
Show Gist options
  • Save frontend-coder/414f4bfad9966fc8d0a38342cbc22745 to your computer and use it in GitHub Desktop.
Save frontend-coder/414f4bfad9966fc8d0a38342cbc22745 to your computer and use it in GitHub Desktop.
30.Кастомайзер. Кастомні опції для сайта #wordpress
function test_customize_personal_register($wp_customize) {
$wp_customize->add_setting('test_link_color', array(
'default'=> '#f3f3f3',
'transport'=> 'refresh',
));
// додаю контрол color picker
$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'test_link_color',
array(
'lqabel' => __('Header Color', 'domein'),
'section' => 'colors', // id секції, де будже разміщений контрол він існує за замовчуванням
'settings' => 'test_link_color',
)
) )
}
add_action('customize_register', 'test_customize_personal_register');
function test_customize_color() {
?>
<style type="text/css">
a{ color: <?php echo get_theme_mod('test_link_color', '#000000') ; ?> }
</style>
<?php
}
add_action('wp_head', 'test_customize_color');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment