I have footer in Wordpress theme, and in the footer paragraph.
It looks like this:
<p><?php echo get_theme_mod( 'site_intro' ); ?></p>
And when you in customizer there is option to change text in footer.
I want to be displayed by default for example:
Copyright 2014.
This is default text, and if user change this, text will be replace Copyright 2014 and it will be text that user has setup.
Where I need to make some code, in footer.php, functions.php where are the rest of the code for customizer?
Is this made with if else statement, or there is some premade code in Wordpress?
This is functions.php
function theme_customize_register( $wp_customize ) { if ( class_exists( 'WP_Customize_Control' ) ) { class PTD_Textarea_Control extends WP_Customize_Control { public function render_content() {?> <label> <span class="customize-control-title"><?php echo esc_html( $this->label );?></span> <textarea class="large-text" cols="20" rows="5" <?php $this->link(); ?>> <?php echo esc_textarea( $this->value() ); ?> </textarea> </label> <?php } } } $wp_customize->add_setting( 'site_intro', array( 'default' => '', 'transport' => 'postMessage' )); $wp_customize->add_section( 'theme_site_info', array( 'title' => 'Footer informaation', 'theme', 'description' => 'Custom Footer', 'theme', 'priority' => 20, )); $wp_customize->add_control( new PTD_Textarea_Control( $wp_customize, 'site_intro_control', array( 'label' => 'Website Footer', 'theme', 'section' => 'theme_site_info', 'settings' => 'site_intro' ))); } add_action( 'customize_register', 'theme_customize_register' );