Skip to content

Commit

Permalink
feat: add option to customize copyright text (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford authored May 11, 2020
1 parent ed415e5 commit 94961a7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
12 changes: 9 additions & 3 deletions newspack-theme/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@
<?php get_template_part( 'template-parts/footer/below-footer', 'widgets' ); ?>

<div class="wrapper site-info-contain">
<?php $blog_info = get_bloginfo( 'name' ); ?>
<?php if ( ! empty( $blog_info ) ) : ?>
<span class="copyright">&copy; <?php echo esc_html( date( 'Y' ) ); ?> <?php bloginfo( 'name' ); ?>.</span>
<?php
$copyright_info = get_bloginfo( 'name' );
$custom_copyright = get_theme_mod( 'footer_copyright', '' );
if ( ! empty( $custom_copyright ) ) {
$copyright_info = $custom_copyright;
}
?>
<?php if ( ! empty( $copyright_info ) ) : ?>
<span class="copyright">&copy; <?php echo esc_html( date( 'Y' ) ); ?> <?php echo esc_html( $copyright_info ); ?>.</span>
<?php endif; ?>

<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'newspack' ) ); ?>" class="imprint">
Expand Down
28 changes: 28 additions & 0 deletions newspack-theme/inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,34 @@ function newspack_customize_register( $wp_customize ) {
)
);

/**
* Footer settings
*/
$wp_customize->add_section(
'footer_options',
array(
'title' => esc_html__( 'Footer Settings', 'newspack' ),
)
);

// Add option to collapse the comments.
$wp_customize->add_setting(
'footer_copyright',
array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'footer_copyright',
array(
'type' => 'text',
'label' => esc_html__( 'Copyright Information', 'newspack' ),
'description' => esc_html__( 'Add custom text to be displayed next to a copyright symbol and current year in the footer. By default, it will display your site title.', 'newspack' ),
'section' => 'footer_options',
)
);

/**
* WooCommerce Order Details settings
*/
Expand Down

0 comments on commit 94961a7

Please sign in to comment.