I'm learning PHP and how customization works on Wordpress. I'm doing a tutorial where they give you this code
function test_customize_register( $wp_customize )
{
$wp_customize->add_setting( 'test_font_color' , array(
'default' => '#0000FF',
'transport' => 'refresh',
));
$wp_customize->add_section( 'test_customize_section' , array(
'title' => __('Opciones Extra','my_test'),
'priority' => 30,
));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'test_color', array(
'label' => __( 'Color de Testeo', 'mytheme' ),
'section' => 'test_customize_section',
'settings' => 'test_font_color'
)));
}
add_action( 'customize_register', 'test_customize_register' );
And then this one
<?php
function test_customize_css() {
if ( get_theme_mod( 'test_font_color' ) ) {
?>
<style type="text/css">
body {
color: <?php echo get_theme_mod('test_font_color'); ?>
}
</style>
<?php
}
}
add_action( 'wp_head', 'test_customize_css');
?>
My question is, do I have to paste this two codes just in the way they are on functions.php or do I have to lock them into the <?php and ?> labels (the two entire codes)?
Thank you.