Right after you install one of our themes, the default copyright text of your site will be vey similar to “Name of the Theme by NiceThemes – Powered by WordPress”
So let’s suppose you want to change that text to something like “My Awesome Business © 2015”. Well, there’s a couple of ways to do this:
Theme Options
- In your WordPress Dashboard, go to NiceThemes > Theme Options, and click on the Footer tab. You’re gonna see the following options:
- Write your text inside inside the “Custom Copyright Text” box and check the “Enable Custom Copyright” option.
- Click the “Save Changes” button. Now you should see your custom copyright text in the footer of the website.
Coding
The PHP function that prints out the copyright text is called nice_copyright()
. If you’re using a Child Theme, you can override that function by declaring it in your functions.php
file doing something like this:
<?php
function nice_copyright() {
echo 'My Awesome Business © 2015';
}
While this is a powerful method, it also might be a double-edged sword, since modifying the copyright text by overriding `nice_copyright()`, depending on how you do it, may nullify the copyright settings under Theme Options and render them unusable.
A more flexible way to do this, that works even if you’re not using a Child Theme, is making use of the nice_copyright_default_args
. This method will change the default copyright text while still allowing you to modify it through Theme Options. The code you’re gonna want to have in your functions.php
file will look similar to this:
<?php
add_filter( 'nice_copyright_default_args', 'my_custom_copyright_filter', 20 );
/**
* Set the copyright arguments for the function nice_copyright()
*/
function my_custom_copyright_filter( $args ){
// Initialize text string.
$text = '';
// Check if the usage of a custom copyright is enabled in Theme Options.
$custom_copyright_enable = get_option( 'nice_custom_copyright_enable' );
// If the custom copyright is enabled, then use it.
if ( ! empty( $custom_copyright_enable ) && nice_bool( $custom_copyright_enable ) ) {
$custom_copyright_text = get_option( 'nice_custom_copyright_text' );
if ( ! empty( $custom_copyright_text ) ) {
$text .= $custom_copyright_text;
}
} else { // If the custom copyright is not enabled, then create our own default text.
$text = 'My Awesome Business © 2015';
}
// Add the copyright text to the copyright arguments and return them.
$args['text'] = $text;
return $args;
}
If you want more information about how filters work, you can read this article in the WordPress Codex.
These are very simple ways to modify the copyright text via PHP, but you can add any kind of additional complexity, depending on your needs and your knowledge of the language.