sewmyheadon /
bitsy
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * bitsy Theme Customizer. |
||||||
| 4 | * |
||||||
| 5 | * @package bitsy |
||||||
| 6 | */ |
||||||
| 7 | |||||||
| 8 | /** |
||||||
| 9 | * Add postMessage support for site title and description for the Theme Customizer. |
||||||
| 10 | * |
||||||
| 11 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
||||||
| 12 | */ |
||||||
| 13 | function bitsy_customize_register( $wp_customize ) { |
||||||
| 14 | $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
||||||
| 15 | $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
||||||
| 16 | $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
||||||
| 17 | |||||||
| 18 | if ( isset( $wp_customize->selective_refresh ) ) { |
||||||
| 19 | $wp_customize->selective_refresh->add_partial( 'blogname', array( |
||||||
| 20 | 'selector' => '.site-title a', |
||||||
| 21 | 'render_callback' => 'bitsy_customize_partial_blogname', |
||||||
| 22 | ) ); |
||||||
| 23 | $wp_customize->selective_refresh->add_partial( 'blogdescription', array( |
||||||
| 24 | 'selector' => '.site-description', |
||||||
| 25 | 'render_callback' => 'bitsy_customize_partial_blogdescription', |
||||||
| 26 | ) ); |
||||||
| 27 | } |
||||||
| 28 | } |
||||||
| 29 | add_action( 'customize_register', 'bitsy_customize_register' ); |
||||||
| 30 | |||||||
| 31 | /** |
||||||
| 32 | * Render the site title for the selective refresh partial. |
||||||
| 33 | * |
||||||
| 34 | * @return void |
||||||
| 35 | */ |
||||||
| 36 | function bitsy_customize_partial_blogname() { |
||||||
| 37 | bloginfo( 'name' ); |
||||||
|
1 ignored issue
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 38 | } |
||||||
| 39 | |||||||
| 40 | /** |
||||||
| 41 | * Render the site tagline for the selective refresh partial. |
||||||
| 42 | * |
||||||
| 43 | * @return void |
||||||
| 44 | */ |
||||||
| 45 | function bitsy_customize_partial_blogdescription() { |
||||||
| 46 | bloginfo( 'description' ); |
||||||
|
1 ignored issue
–
show
The function
bloginfo was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 47 | } |
||||||
| 48 | |||||||
| 49 | /** |
||||||
| 50 | * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. |
||||||
| 51 | */ |
||||||
| 52 | function bitsy_customize_preview_js() { |
||||||
| 53 | wp_enqueue_script( 'bitsy_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); |
||||||
| 54 | } |
||||||
| 55 | add_action( 'customize_preview_init', 'bitsy_customize_preview_js' ); |
||||||
| 56 |