Browse Source

Fix contact form title (fixes #122). (#123)

pull/124/head
Ned Zimmerman 7 years ago committed by GitHub
parent
commit
563bc50e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      inc/customizer/namespace.php
  2. 2
      partials/contact-form.php

40
inc/customizer/namespace.php

@ -30,11 +30,27 @@ function customize_register( \WP_Customize_Manager $wp_customize ) {
if ( isset( $wp_customize->selective_refresh ) ) { if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( 'blogname', [ $wp_customize->selective_refresh->add_partial( 'blogname', [
'selector' => '.site-title a', 'selector' => '.site-title a',
'render_callback' => __NAMESPACE__ . '\\customize_partial_blogname', 'render_callback' => function() {
bloginfo( 'name' );
},
] ); ] );
$wp_customize->selective_refresh->add_partial( 'blogdescription', [ $wp_customize->selective_refresh->add_partial( 'blogdescription', [
'selector' => '.site-description', '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', [ $wp_customize->add_setting('pb_front_page_catalog_title', [
'type' => 'option', 'type' => 'option',
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
'default' => __( 'Our Latest Titles', 'pressbooks-aldine' ),
]); ]);
$wp_customize->add_control('pb_front_page_catalog_title', [ $wp_customize->add_control('pb_front_page_catalog_title', [
'label' => __( 'Front Page Catalog Title', 'pressbooks-aldine' ), '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', [ $wp_customize->add_setting('pb_network_contact_form_title', [
'type' => 'option', 'type' => 'option',
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
'default' => __( 'Contact Us', 'pressbooks-aldine' ),
]); ]);
$wp_customize->add_control('pb_network_contact_form_title', [ $wp_customize->add_control('pb_network_contact_form_title', [
'label' => __( 'Contact Form Title', 'pressbooks-aldine' ), '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. * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/ */

2
partials/contact-form.php

@ -9,7 +9,7 @@
<?php <?php
$pb_network_contact_form_title = get_option( 'pb_network_contact_form_title' ); $pb_network_contact_form_title = get_option( 'pb_network_contact_form_title' );
$contact_form_title = ( ! empty( $pb_front_page_catalog_title ) ) ? $pb_front_page_catalog_title : __( 'Contact Us', 'pressbooks-aldine' ); $contact_form_title = ( ! empty( $pb_network_contact_form_title ) ) ? $pb_network_contact_form_title : __( 'Contact Us', 'pressbooks-aldine' );
$contact_form_response = \Aldine\Helpers\handle_contact_form_submission(); $contact_form_response = \Aldine\Helpers\handle_contact_form_submission();
?> ?>

Loading…
Cancel
Save