Previously on the CogitActive Saga:
The copyright notice is no longer a legal requirement
; yet, displaying this information might discourage and deter would-be-thieves from stealing [your graphics] in fear of potential repercussions
.
People are often unaware of copyright law, assuming that they can use anything published on the Internet without permission. As abridged in How to protect my graphics?, while the copyright notice – using the symbol © – is no longer a legal requirement
1, it remains a good practice as a highly visible way to emphasize that that work is protected by copyright
1. Such a notice consists of three elements:
- The copyright symbol © or the word “copyright”
- The year of publication/creation of the work
- The name of the copyright owner
What if the footer area of my website is already used for something else?
The default WordPress themes display indeed in this area the Proudly powered by WordPress
link to WordPress.org. Now, while providing on your site at least one link back to the WordPress website is common courtesy and a great way of saying thanks
2, you aren’t required to acknowledge that you’re using the WordPress software on your site
2. Besides, this might be an easy identification for hackers to find a WordPress site using default themes
– even though opinions diverge on whether this is unsafe or harmless. Anyway, regardless of the efficiency of security through obscurity (aka obfuscation security), this credit may not be aligned with your idea of a professional looking website.
Not so surprisingly, there are plenty of tutorials on how to remove this credit message and/or how to add a copyright notice in its stead. However, using the Twenty Seventeen theme turned out to be a complicating factor. Indeed, insofar as this theme is concerned, most articles are referring to outdated or, worse still, wrong methods. As often with online information3, you have to separate the wheat from the chaff, and that’s precisely what this post aims to achieve. So, how to add your own copyright notice in the footer of Twenty Seventeen? The proper way!
What NOT to do
Fortunately, I did not stop my quest at the first article (as ranked by Google) – not even the ones from WordPress.org actually. In keeping with CogitActive modus operandi, I went through many sources of information before to find the correct way to replace the WordPress credit with a copyright notice. As briefly alluded, too many tutorials communicate invalid techniques – the problem extending beyond the peculiarity of Twenty Seventeen. Here are the two most encountered ill-advised approaches.
Removing Hiding it with CSS
Being quick and easy, no wonder this method is mentioned (almost) every time. At least, some authors have the decency to describe it as a way to hide, rather than remove, the Proudly powered by WordPress
link. Anyway, this non-solution should be avoided – as recommended by too few good articles!
The idea, here, is to use the CSS display property, which specifies if/how an HTML element is displayed. Using the value “none” will indeed hide the element, but not delete it. Opportunely, the WordPress credit is contained within a <div> element, which is associated with the “site-info” class. Accordingly, the trick is to add .site-info {display: none; } either to the Additional CSS panel of the Customizer or to the style.css file of your child theme.
Again, you should avoid this approach because it will not remove, but just hide, the message. Not only is this inefficient, but also it will jeopardize your SEO efforts. Spammers often use this technique to hide links; thus, your site might get flagged by Google.
Invalid method (for Twenty Seventeen)
It’s not the first time that I have to complain about the dishonest practice of recycling articles without updating the content. While some limits their deceit to changing automatically the published date (or the modified date), others go as far as updating the title as well; of course without modifying the content (e.g. “Best WordPress theme for 2020” for an article unchanged since 2013 or “How to customize the Twenty Seventeen theme” while the method refers actually to Twenty Thirteen).
From the very first default theme, namely WordPress Classic, the link credit was in the footer.php file. If you inspect all twelve themes (see table below), you will indeed find this information coded there. In all with the exception of one! Twenty Seventeen, of course. I’ll come back to this shortly. Nevertheless, the code (to implement this credit link) has drastically changed over the years. For instance, compare the excerpts from the footer.php files of WordPress Classic and Twenty Twenty:
WordPress Classic
<p class="credit"><!--<?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. --> <cite><?php echo sprintf(__("Powered by <a href='http://wordpress.org/' title='%s'><strong>WordPress</strong></a>"), __("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></cite></p>
Twenty Twenty
<p class="powered-by-wordpress">
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentytwenty' ) ); ?>">
<?php _e( 'Powered by WordPress', 'twentytwenty' ); ?>
</a>
</p>
Admittedly, asides from Kubrick (aka Default), the code remains relatively stable from one theme to another (with the exception of Twenty Seventeen naturally). You don’t have to take my word for it; check by yourself:
WordPress Classic | Default | Twenty Ten |
Twenty Eleven | Twenty Twelve | Twenty Thirteen |
Twenty Fourteen | Twenty Fifteen | Twenty Sixteen |
Twenty Seventeen | Twenty Nineteen | Twenty Twenty |
Given this relative stability – and the bad practice aforementioned – most articles advice to remove completely the block of code between <div class="site-info"> and </div> <!-- .site-info --> from the footer.php file. Again, putting asides the very old themes (i.e. WordPress Classic, Default, Twenty Ten and Twenty Eleven), this would do the job, at least part of it4, for all but two themes!
Try to find this piece of code in the footer.php file of Twenty Seventeen. Good luck! For a reason that I don’t fathom, the developers of this theme decided to place the footer site info somewhere else and to call it with the following line of code:
get_template_part( 'template-parts/footer/site', 'info' );
Clearly, the classical technique (to remove the credit link) could not be applied to Twenty Seventeen; yet, most article would shamelessly provide it in their updated recycled article entitles blatantly “… in Twenty Seventeen”. Now, some posts (probably written specifically for Twenty Seventeen) referred to the above line of code; yet, they still fail to provide the correct method. Here are three BAD instructions – which you should NOT follow:
Remove the following code (from the footer.php file):
<?php
endif;
get_template_part( 'template-parts/footer/site', 'info' );
?>
Remove the following line (or comment it out):
get_template_part( 'template-parts/footer/site', 'info' );
Replace the ‘info’ in the above code with ‘none’, like this:
get_template_part( 'template-parts/footer/site', 'none' );
The new kid on the block – Twenty Twenty – is the second exception; it uses the class “footer-credits” instead of “site-info”. Moreover, unlike any of its predecessors, it incorporates a copyright notice by default! In fact, if you were to remove the whole <div> element, you would also remove this nice addition by the developers. Instead, you should remove only the following piece of code:
<p class="powered-by-wordpress">
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentytwenty' ) ); ?>">
<?php _e( 'Powered by WordPress', 'twentytwenty' ); ?>
</a>
</p><!-- .powered-by-wordpress -->
Wrong substance and wrong form!
Be it through CSS or by modifying the footer.php file, on top of providing wrong methods to remove the Proudly powered by WordPress
, most of those articles are also instructing – ill-advisedly – to do these changes via the theme editor. Clearly, those authors do not know about the #1 Rule of WordPress development.
The #1 Rule of WordPress development is to never directly modify WordPress files.WordPress
Basically, you should NOT be using the theme editor because the changes made there are instant. Any error you introduce will crash your site; you cannot even fix this from there. If being stuck with a broken theme wasn’t enough of a reason, here is another motive not to use the theme editor: updates will wipe out your modifications. Indeed, all your changes (via the code editor) will be overwritten with the next update. Not updating your theme to prevent this to happen is not even conceivable (see Updates & Upgrade Network). In fact, the recommended only way to customize a WordPress theme safely is to use a child theme.
Child themes should always be used if you plan on modifying even a single character in your theme. There are two very good reasons: updates and organization.Daniel Pataki
The correct way
After warning you against all these misleading articles, it’s time to show you how to replace – in Twenty Seventeen – WordPress credit link (in the footer) with your own copyright notice.
Creating a child theme
Naturally, the first step is to create a child theme. As explained in more details elsewhere, a child theme overrides the parent theme. This means that if the same file exists in both themes, WordPress will use the file from the child theme, and ignore the one from the parent theme. Thus, in order to remove Proudly powered by WordPress
, for instance, you just have to create a duplicate of the file you want to change from the parent theme (i.e. the one coding this credit link), apply the modifications you want to this file (see below), and add this revised file to your child theme. That’s it.
If you haven’t created a child theme already, you may want to consider following the procedure described in the so-called article:
Removing Proudly powered by WordPress
As you may have guessed, the file that needs to be modified – for the Twenty Seventeen theme – is NOT footer.php. Fortunately, the path to the actual file is easy to find (i.e. betrayed in the following line of code):
get_template_part( 'template-parts/footer/site', 'info' );
Sure enough, if you navigate to /wp_content, /themes, /twentyseventeen, /template-parts and then to /footer (within the directory of Twenty Seventeen), you will see two files: footer-widgets.php and site-info.php. The second file is the one of interest for the task at hand. Simply download it to your computer and edit it with a dedicated software (or, failing that, with Notepad). Do not use a word processing program, such as Microsoft Word, because the latter will insert formatting information into the file; thus messing up the code.
Back then (when I actually did this), the code was as follow:
<?php
/**
* Displays footer site info
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0
*/
?>
<div class="site-info">
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentyseventeen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentyseventeen' ), 'WordPress' ); ?></a>
</div><!-- .site-info -->
To remove the Proudly powered by WordPress
from the footer, I could have removed everything from <div class="site-info"> to </div><!-- .site-info --> (back then5). However, I wanted to replace this credit link with my copyright notice…
Adding the copyright notice
… therefore, instead of deleting everything, I replaced the following <a> element:
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentyseventeen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentyseventeen' ), 'WordPress' ); ?></a>
with my own code:
<a href="https://cogitactive.com">CogitActive</a> | Copyright © 2017-<?php echo date ('Y');?> Alexandre Seillier
The first part should be familiar to you; it’s just an HTML <a> element to display a link to my website. The part from “|” to “2017-” is nothing but plain text, with the exception of “©”, which is the HTML reference for the © character. Then, there is a small part of PHP in order to output (i.e. echo) the current year automatically thanks to the date ('Y') function (where the format Y specifies a four-digit representation of a year). Like this, I don’t have to edit this file every year! The last part, again, is simply text – the name of the copyright owner (i.e. me).
Last step
I saved the file (as site-info.php) and uploaded it to my child theme. Be careful; it is critical that you place this file in the same folder structure as the parent theme. Accordingly, within the folder of my child theme, I created a /template-parts and then a /footer folder before to upload my edited site-info.php file to the latter. And voilà!
CogitActive | Copyright © 2017-2020 Alexandre Seillier
Now, you may have already figured out that this story is not over yet. Of course, I didn’t know that back then. Unhappily, you will have to wait the coming posts to know what this is about…
1 See Frequently Asked Questions: Copyright. ^
2 Lisa Sabin-Wilson (2017) WordPress All-in-One For Dummies – Third Edition. Hoboken, New Jersey: John Wiley & Sons. ^
3 It’s time to reiterate my word of caution: you can’t trust everything you read! On that matter, you may want to consider checking the “Evaluation of sources” section of my How to podcast? post. ^
4 Removing Proudly powered by WordPress
is one thing, replacing this credit link with a copyright notice is another task! ^
5 If you want to do this now (i.e. with version 2.3), you should only remove the <a> element, that is the six lines of code starting with <a href= and finishing with </a>. ^