I'm trying to create a dynamic footer, where the year is automatically updated. In PHP, this can be done using the following snippet:
<?php echo date("Y"); ?>
My site is on Wordpress, and because of the way the footer is structured in the theme, I am inputting the copyright notice in place of the generic Wordpress "powered by" statement, using the following filter:
<?php
add_filter ('esc_html', 'wpse_245817_esc_html', 100, 2 );
function wpse_245817_esc_html( $safe_text, $text ) {
if ( $safe_text == 'Powered by %2$s' ) {
return '© Company';
}
return $safe_text;
This outputs the copyright symbol as well as the company name (©Company), but not the date, as I cannot place the PHP snippet directly within the return statement as is.
What would be the appropriate way to add the snippet within the scope of the filter? The final output I am trying to show is: ©2017 Company.