As Jacob Peattie commented, there isn’t a standard way to do this that would work with all themes, but you can add an action to the wp_footer
hook (https://developer.wordpress.org/reference/hooks/wp_footer/). This would add some content before the closing body tag. A simple implementation would be as follows:
<?php
/*
Plugin Name: Year Footer
Description: Add the current year to the footer.
Author: Tim Ross
Version: 1.0.0
Author URI: https://timrosswebdevelopment.com
*/
function year_footer() {
echo '<div>© ' . date('Y') . '</div>';
}
add_action('wp_footer', 'year_footer', 9);
If you wanted to add a settings box at the bottom of “Settings -> Reading” to make the content editable, then you need some more code (see https://developer.wordpress.org/plugins/settings/using-settings-api/):
<?php
/*
Plugin Name: Year Footer
Description: Add the current year to the footer.
Author: Tim Ross
Version: 1.0.0
Author URI: https://timrosswebdevelopment.com
*/
function year_footer_settings_init() {
// register a new setting for "reading" page
register_setting('reading', 'year_footer_content');
// register a new section in the "reading" page
add_settings_section(
'year_footer_settings_section',
'Year Footer Settings Section', 'year_footer_settings_section_callback',
'reading'
);
// register a new field in the "year_footer_settings_section" section, inside the "reading" page
add_settings_field(
'year_footer_settings_field',
'Year Footer Setting', 'year_footer_settings_field_callback',
'reading',
'year_footer_settings_section'
);
}
/**
* register year_footer_settings_init to the admin_init action hook
*/
add_action('admin_init', 'year_footer_settings_init');
/**
* callback functions
*/
// section content cb
function year_footer_settings_section_callback() {
echo '<p>Update the content of the footer.</p>';
}
// field content cb
function year_footer_settings_field_callback() {
// get the value of the setting we've registered with register_setting()
$setting = get_option('year_footer_content');
// output the field?>
<input type="text" name="year_footer_content" value="<?php echo isset($setting) ? esc_attr($setting) : ''; ?>">
<?php
}
function year_footer() {
$year_footer_content = get_option('year_footer_content');
echo '<div>' . esc_html($year_footer_content) . '</div>';
}
add_action('wp_footer', 'year_footer', 9);
If you need a separate settings page, then you need to create one following the example from the docs