Last active
June 2, 2022 12:34
-
-
Save frontend-coder/414f4bfad9966fc8d0a38342cbc22745 to your computer and use it in GitHub Desktop.
30.Кастомайзер. Кастомні опції для сайта #wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment