Viewing 6 replies - 1 through 6 (of 6 total)
  • The code under “Solution 1” from your link works fine for me. The new section “Home Header” is to be seen, in it then also the input field.

    If it does not work for you, it could be due to your theme. Which one do you use?

    Thread Starter Rihan Habib

    (@xihad1)

    Hello @threadi thank you so much for your response. I have tried in my custom theme, there default text or textarea are not working. default img is okay.What’s going wrong, I followed many examples.

    • This reply was modified 2 years, 1 month ago by Rihan Habib.

    Could you provide the source code you used so that people can take a look?

    Thread Starter Rihan Habib

    (@xihad1)

    @threadi

    customizer.php:

    function rhx_portfolio_customize_register( $wp_customize ) {

    $wp_customize->remove_section(‘nav’);
    $wp_customize->remove_section(‘static_front_page’);
    $wp_customize->remove_section(‘title_tagline’);

    $wp_customize->add_panel(‘panel_9’, array(
    ‘priority’ => 17,
    ‘capability’ => ‘edit_theme_options’,
    ‘theme_supports’ => ”,
    ‘title’ => __(‘Footer’, ‘rhx-portfolio’) ,
    ‘description’ => ‘aaaa’,
    ));

    `/* ======================== Footer Below Text ===================== */
    $wp_customize->add_section(‘section_35’, array(
    ‘title’ => ‘Footer Below’,
    ‘priority’ => 35,
    ‘panel’ => ‘panel_9’
    ));

    /* ———————- Footer Below Text setting and control —————— */
    $wp_customize->add_setting(‘footerBelow’, array(
    ‘capability’ => ‘edit_theme_options’,
    ‘default’ => __(‘Clean. Simple. Sincere’, ‘sincere’),
    ‘sanitize_callback’ => ‘sanitize_text_field’,
    ));

    $wp_customize->add_control(‘footerBelow’, array(
    ‘type’ => ‘text’,
    ‘section’ => ‘section_35’,
    ‘label’ => __( ‘Add Footer Below Text’ )
    ));

    }
    add_action( ‘customize_register’, ‘rhx_portfolio_customize_register’ );

    front-page.php
    <?php echo get_theme_mod(‘footerBelow’, __(‘Clean. Simple. Sincere’, ‘sincere’) ); ?>

    For me the code works as it is. I put it in the functions.php of my child theme and the output there is simply

    if( !is_admin() ) {
    	echo get_theme_mod( 'footerBelow', __( 'Clean. Simple. Sincere', 'sincere' ) );
    }

    In the frontend I see “Clean. Simple. Sincere” and in the Customizer I also see the item Footer > Footer Below > and there the field with the text.

    If this is not the case for you, something must be preventing the output. Maybe a plugin or something else in your theme.

    Thread Starter Rihan Habib

    (@xihad1)

    @threadi Hello I have created a new theme there default texts are working but when I erase default text and refresh then text are not showing. I want to set default text show always if I not write any new text there. Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Default text not working customizer’ is closed to new replies.