Assuming you have a child theme so that you don't need to keep editing footer.php every time your parent theme updates. Add the code below to functions.php of your child theme
function whatever_copyright() {
global $wpdb; //get db variable wordpress
$start_year=2000; //set start year here
$company ="Some Company Name."; //set the Company Name for the website footer
$rights ="All rights Reserved."; //the classic All rights reserved tagline
//just some credits to the developer and a nice backlink to his/her website
$developer ='Designed and Developed by <a href="https://www.georgenicolaou.me" target="_blank" rel="noopener noreferrer" title="George Nicolaou">George Nicolaou</a>';
//query the db for the first or last date something was published and tell me the year
$copyright_dates = $wpdb->get_results("
SELECT
YEAR(min(post_date_gmt)) AS firstdate,
YEAR(max(post_date_gmt)) AS lastdate
FROM
$wpdb->posts
WHERE
post_status = 'publish'
");
$output = '';
if($copyright_dates) {
$copyright = $copyright_dates[0]->firstdate;
if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
$copyright .= '-' . $copyright_dates[0]->lastdate;
}
$output = "&copy; " .$start_year.'-'.$copyright . ' '.$company. ' '.$rights. ' '.$developer;
}
return $output;
}
Than just call the function inside footer.php. In divi 3.0 I commented out line #39 and added the code below right after that
echo whatever_copyright();

I used this cool plugin that seems to work well with Divi 3.0 called Child Theme Configurator to create the initial child theme

WP Feedback

Dive straight into the feedback!
Login below and you can start commenting using your own user instantly

Pin It on Pinterest

Share This
Divi Theme Code Snippets Add a dynamic footer to any WordPress site