TwentyFifteen with a footer text customizer control including an edit shortcode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Enqueue the parent style | |
*/ | |
function twentyfifteen_parent_enqueue_styles() { | |
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'twentyfifteen_parent_enqueue_styles' ); | |
/** | |
* Adds an control to set a custom footer text. | |
* | |
* @param WP_Customize_Manager $wp_customize The customizer manager. | |
*/ | |
function twentyfifteen_footer_setting_custom_footer( $wp_customize ) { | |
$wp_customize->add_setting( 'custom_footer_text', array( | |
'type' => 'theme_mod', | |
) ); | |
$wp_customize->add_control( 'custom_footer_text', array( | |
'label' => __( 'Custom footer text', 'twentyfifteen-footer' ), | |
'type' => 'textarea', | |
'section' => 'custom_footer', | |
) ); | |
$wp_customize->add_section( 'custom_footer', array( | |
'title' => __( 'Custom footer text', 'twentyfifteen-footer' ), | |
'description' => __( 'Set the footer text here', 'twentyfifteen-footer' ), | |
'priority' => 160, | |
'capability' => 'edit_theme_options', | |
) ); | |
$wp_customize->get_setting( 'custom_footer_text' )->transport = 'postMessage'; | |
$wp_customize->selective_refresh->add_partial( 'custom_footer_text', array( | |
'selector' => '.site-info .footer-text', | |
'render_callback' => 'twentyfifteen_footer_partial_custom_footer_text', | |
) ); | |
} | |
add_action( 'customize_register', 'twentyfifteen_footer_setting_custom_footer' ); | |
/** | |
* Callback function fot the selective refresh | |
*/ | |
function twentyfifteen_footer_partial_custom_footer_text() { | |
echo get_theme_mod( 'custom_footer_text' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Theme Name: TwentyFifteen Footer Text | |
Template: twentyfifteen | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment