Hello,
To add your own text to the Storefront theme footer, you need to create a child theme. In functions.php of your child theme, you can rewrite the function that adds text to the footer. This is a pluggable function, which means that, if your child theme has a function with the same name, then your theme’s function will run, otherwise the parent theme’s function will run.
The function is called storefront_credit()
and it’s hooked to the storefront_footer
action hook. You can rewrite this function in your child theme’s functions.php file along the following lines:
function storefront_credit() {
?>
<div class="site-info">
<?php echo 'Your text here.'; ?>
</div><!-- .site-info -->
<?php
}
Now your child theme’s footer should have ‘Your text here.’ printed on it. If you’d like to see a better way to output the text, see how Storefront does it in storefront/inc/structure/footer.php, where you can find the original storefront_credit() function. Simply copy it into your functions.php file and modify it to your needs.
I hope this helps 🙂
-Maria Antonietta
Hello,
So should I copy and paste the above into my functions file and change the text here to mine?
Thanks!
Hi, yes that’s just about all you need to do. Provided you’re using a child theme with Storefront, it should give you the right result.
ok i just noticed that i already have this in my functions file.
function custom_storefront_credit() {
?>
<div class=”site-info”>
© <?php echo get_bloginfo( ‘name’ ) . ‘ ‘ . get_the_date( ‘Y’ ); ?>
</div><!– .site-info –>
<?php
}
where do i add my wording?
Sorry, still pretty new to all of this!
You need to call your function exactly the same as the parent theme’s function, so that it overrides it: storefront_credit()
Just copy and paste the function I gave you above in your child theme’s functions.php file, save and check the result. Then, replace
Your text here.
with your text. Save again and check.
My page crashes when I insert the code into my child theme’s functions.php
Her it is:
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
function storefront_credit() {
?>
<div class="site-info">
© <?php echo 'my-text'; ?>
</div><!-- .site-info -->
<?php
}
-
This reply was modified 7 years, 2 months ago by martin136.
-
This reply was modified 7 years, 2 months ago by martin136.
I had to add another <?php in front of and an ?> after the code.
Now it works 🙂