Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace hardcoded footer copyright text with customizer copyright text #104

Merged
merged 1 commit into from
Nov 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
<div class="wrap">

<div class="site-info">
<a href="<?php echo esc_url( __( 'https://wordpress.org/', '_s' ) ); ?>"><?php printf( esc_html__( 'Proudly powered by %s', '_s' ), 'WordPress' ); ?></a>
<span class="sep"> | </span>
<?php printf( esc_html__( 'Theme: %1$s by %2$s.', '_s' ), '_s', '<a href="http://automattic.com/" rel="designer">Automattic</a>' ); ?>
<?php _s_do_copyright_text(); ?>
</div><!-- .site-info -->

</div><!-- .wrap -->
Expand Down
4 changes: 2 additions & 2 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ function _s_customize_register( $wp_customize ) {
$wp_customize->add_setting(
'_s_copyright_text',
array(
'default' => '',
'sanitize_callback' => '_s_sanitize_customizer_text'
'default' => ''
)
);
$wp_customize->add_control(
Expand All @@ -72,6 +71,7 @@ function _s_customize_register( $wp_customize ) {
'description' => __( 'The copyright text will be displayed beneath the menu in the footer.', '_s' ),
'section' => '_s_footer_section',
'type' => 'text',
'sanitize' => 'html'
)
);
}
Expand Down
17 changes: 17 additions & 0 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,20 @@ function _s_get_attachment_id_from_url( $attachment_url = '' ) {

return $attachment_id;
}

/**
* Echo the copyright text saved in the Customizer
*/
function _s_do_copyright_text() {

// Grab our customizer settings
$copyright_text = get_theme_mod( '_s_copyright_text' );

// Stop if there's nothing to display
if ( ! $copyright_text ) {
return;
}

// Echo the text
echo '<span class="copyright-text">' . wp_kses_post( $copyright_text ) . '</span>';
}