From 563bc50e315ee5b3ccd067dbd2f458b33e92e27a Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Sat, 21 Apr 2018 16:15:39 -0300 Subject: [PATCH] Fix contact form title (fixes #122). (#123) --- inc/customizer/namespace.php | 40 ++++++++++++++++++------------------ partials/contact-form.php | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/inc/customizer/namespace.php b/inc/customizer/namespace.php index d099711..31aa5bb 100644 --- a/inc/customizer/namespace.php +++ b/inc/customizer/namespace.php @@ -30,11 +30,27 @@ function customize_register( \WP_Customize_Manager $wp_customize ) { if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', [ 'selector' => '.site-title a', - 'render_callback' => __NAMESPACE__ . '\\customize_partial_blogname', + 'render_callback' => function() { + bloginfo( 'name' ); + }, ] ); $wp_customize->selective_refresh->add_partial( 'blogdescription', [ 'selector' => '.site-description', - 'render_callback' => __NAMESPACE__ . '\\customize_partial_blogdescription', + 'render_callback' => function() { + bloginfo( 'description' ); + }, + ] ); + $wp_customize->selective_refresh->add_partial( 'pb_front_page_catalog_title', [ + 'selector' => '#latest-books-title', + 'render_callback' => function() { + get_option( 'pb_front_page_catalog_title' ); + }, + ] ); + $wp_customize->selective_refresh->add_partial( 'pb_network_contact_form_title', [ + 'selector' => '#contact .contact__title', + 'render_callback' => function() { + get_option( 'pb_network_contact_form_title' ); + }, ] ); } @@ -119,6 +135,7 @@ function customize_register( \WP_Customize_Manager $wp_customize ) { $wp_customize->add_setting('pb_front_page_catalog_title', [ 'type' => 'option', 'sanitize_callback' => 'sanitize_text_field', + 'default' => __( 'Our Latest Titles', 'pressbooks-aldine' ), ]); $wp_customize->add_control('pb_front_page_catalog_title', [ 'label' => __( 'Front Page Catalog Title', 'pressbooks-aldine' ), @@ -143,6 +160,7 @@ function customize_register( \WP_Customize_Manager $wp_customize ) { $wp_customize->add_setting('pb_network_contact_form_title', [ 'type' => 'option', 'sanitize_callback' => 'sanitize_text_field', + 'default' => __( 'Contact Us', 'pressbooks-aldine' ), ]); $wp_customize->add_control('pb_network_contact_form_title', [ 'label' => __( 'Contact Form Title', 'pressbooks-aldine' ), @@ -161,24 +179,6 @@ function customize_register( \WP_Customize_Manager $wp_customize ) { ]); } -/** - * Render the site title for the selective refresh partial. - * - * @return void - */ -function customize_partial_blogname() { - bloginfo( 'name' ); -} - -/** - * Render the site tagline for the selective refresh partial. - * - * @return void - */ -function customize_partial_blogdescription() { - bloginfo( 'description' ); -} - /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ diff --git a/partials/contact-form.php b/partials/contact-form.php index 14506f2..e8d339a 100644 --- a/partials/contact-form.php +++ b/partials/contact-form.php @@ -9,7 +9,7 @@