$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Child Theme disable customizer defaults|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Child Theme disable customizer defaults

matteradmin7PV0评论

I am trying to extend twentyseventeen theme. I want to achieve two simple goals.

  1. No custom header image
  2. Don't show the Title and tagline by default.

But I would like to keep those options available for the end user if he/she wishes to re-enable to show the title and tagline or add new custom image.

I have been trying with customizer api but not working..

Essentially if I apply child theme.. Customizer should have the checkbox unchecked for "Display Site Title and Tagline" in "Site Identity". Also "Header Media" -> "Current Header" to be null. Also in the page those settings should be reflected.

Things which I tried..

function themeslug_customize_register( $wp_customize ) {
  // Do stuff with $wp_customize, the WP_Customize_Manager object.
  // TRY 1 - DID NOT WORK
  $wp_customize->get_setting( 'header_text' )->default = 0;
  // TRY 2 - DID NOT WORK
  $wp_customize->add_setting('header_text',
     array(
        'theme_supports'    => array( 'custom-logo', 'header-text' ),
        'default'           => 0,
        'sanitize_callback' => 'absint',
     )
  );
  // TRY 3 - DID NOT WORK
  $wp_customize->get_setting( 'blogdescription' )->default = 'Custom test';

}
add_action( 'customize_register', 'themeslug_customize_register' );

// TRY 4 - this works.. BUT this removes the setting altogether leaving no option to bring 

// back custom header. So this undesirable. add_action( 'after_setup_theme', 'remove_featured_images_from_child_theme', 11 ); function remove_featured_images_from_child_theme() { remove_theme_support( 'custom-header' ); }

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far