I need to add PHP to pull the current year for copyright in the footer. This doesn’t seem to be working. Any ideas?
Hello @w3developing,
Thanks for asking.
Please add following code in child theme function.php file to display current year in footer:
add_action( 'wp_footer', 'adding_scripts_to_footer', 10 );
function adding_scripts_to_footer() { ?>
<div class="x-container max width">
© 2010<script>new Date().getFullYear()>2010&&document.write("-"+new Date().getFullYear());</script>, Company.
</div>
<?php }
You can use following resources to download and setup child theme.
Download Child theme from following source: https://theme.co/apex/child-themes
Please take a look at following article to setup child theme:
Thanks.
Ok, so there isn’t a way to put PHP directly in the pro footer with a text box or content area?
Hello @w3developing,
Thanks for updating the thread.
You need to add the PHP codes in theme files. Please use above method to display current year information into footer.
Thanks.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.