Customize the Footer Credits in Storefront

Have you noticed that in the Storefront theme there are footer credits for the theme itself and WooCommerce?

It is possible to hide those credits from the Customizer in the Footer section, but it’s nice to keep them around to support the developers. It might be useful though to add your company name as well or change the text to something else that you prefer.

You can do it, as always, via custom code!

This time it’s not a simple snippet though. The only filter that we have for the footer credits is storefront_credit_link, but this one is used to simply hide the entire thing.

We don’t want to do that, also because we have an option for it. We have to use a different method.

Did you know that many of the Storefront functions are pluggable? What does it mean? It means that you can declare a function with the same name of the one included in the theme/plugins without creating a fatal error, and your function will completely replace the one from the core.

The name of the function that prints the footer credits is storefront_credit and you can find it in /wp-content/themes/storefront/inc/storefront-template-functions.php on line 125.

Let’s replace it. Open your functions.php file in wp-content/themes/your-child-theme-name/ and add this code at the end of the file:


/**
* Display the theme credit
*
* @since 1.0.0
* @return void
*/
function storefront_credit() {
?>
<div class="site-info">
<?php echo esc_html( apply_filters( 'storefront_copyright_text', $content = '&copy; ' . get_bloginfo( 'name' ) . ' ' . date( 'Y' ) ) ); ?>
<?php if ( apply_filters( 'storefront_credit_link', true ) ) { ?>
<br /> <?php echo '<a href="https://woocommerce.com&quot; target="_blank" title="' . esc_attr__( 'WooCommerce – The Best eCommerce Platform for WordPress', 'storefront' ) . '" rel="author">' . esc_html__( 'Built with Storefront &amp; WooCommerce', 'storefront' ) . '</a>' ?> by <a href="https://yourdomain.com" title="Your Company Name">Your Company Name</a>.
<?php } ?>
</div><!– .site-info –>
<?php
}

view raw

functions.php

hosted with ❤ by GitHub

This snippet will add a link to your company after the default footer credits. All this is done where you see this code:

by <a href="https://yourdomain.com" title="Your Company Name">Your Company Name</a>.


Just replace these data with your company’s data or anything you prefer, and you’re done!


More Posts That You Might Like…


4 responses to “Customize the Footer Credits in Storefront”

  1. Hi 🙂
    I use the plugin: code snippets to insert codes but when I use the one above this error occurs:
    The code snippet you are trying to save produced a fatal error on line 16:

    Cannot redeclare storefront_credit() (previously declared in /var/www/www.nordpet.dk/www/wp-content/themes/storefront/inc/storefront-template-functions.php:127)

    And being new in all of this I don’t know what’s wrong?

    Kind regards,
    Line

  2. Thanks for sharing! I did it!

  3. If you can’t/want to code, or you need a more configurable solution, there is a plugin that turns the Storefront copyright into a sidebar, then you can add everything you need (menus, logos, free HTML, anything) through widgets on it: https://wordpress.org/plugins/change-storefront-copyright-widgets/

Leave a Reply

Categories

Newsletter

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Blog at WordPress.com.

%d bloggers like this: