Monday, May 30, 2022
HomeWordPress Developmentphp - Getting textual content from customized area from customizer

php – Getting textual content from customized area from customizer


So I’ve created a panel within the customizer part in WordPress so as to add the telephone quantity to the location.
It really works high quality within the again finish nevertheless it wont present up within the entrance finish

right here is my features.php

    operate home_smart_register_theme_customizer( $wp_customize ) {
    $wp_customize->add_panel( 'contact_info', array(
        'precedence'       => 10,
        'theme_supports' => '',
        'title'          => __( 'Contact Data', 'home_smart' ),
        'description'    => __( 'Set your present tackle.', 'home_smart' ),
    ) );
    $wp_customize->add_section( 'contact_details_block' , array(
        'title'    => __('Cellphone Quantity','home_smart'),
        'panel'    => 'contact_info',
        'precedence' => 10
    ) );
    $wp_customize->add_setting( 'address_block', array(
         'default'           => __( 'Default textual content', 'home_smart' ),
         'sanitize_callback' => 'sanitize_text'
    ) );
    $wp_customize->add_control( new WP_Customize_Control(
        $wp_customize,
        'contact_details_block',
            array(
                'label'    => __( 'Quantity', 'home_smart' ),
                'part'  => 'contact_details_block',
                'settings' => 'address_block',
                'kind'     => 'textual content'
            )
        )
    );
  
    operate sanitize_text( $textual content ) {
        return sanitize_text_field( $textual content );
    }
}
add_action( 'customize_register', 'home_smart_register_theme_customizer' );

right here is my footer.php

 <p>
            <?php
            operate add_phone_number(){
                    echo  get_theme_mod('address_block'); 
            }
            add_action('home_smart_number', 'add_phone_number'); 
            ?>
</p>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments