Archived topic
Assistance With Different Footer Text For Posts / Pages
5 replies · Started by Marty on November 8, 2022
Hi there, sorry to bug you guys again but unfortunately I cannot seem to find a solution to this.
I'd like to no longer use only the site-wide text footer located in Customizing ▸ Layout ▸ Footer ▸ Copyright but rather:
• "Text A" on [x] pages (pretty much all pages actually)
• "Text B" (affiliate etc. text) on [x] posts.
I've created footer Layout elements but with no success - I can't seem to affect the text in the footer itself - it's either above it, below it, or something else. I've tried shortcodes also in the footer to use with test text, and that didn't work either.
Regardless of what I do, it's always the default copyright & GeneratePress text in the footer. Perhaps I missed something somewhere? Thank you very much.
Hi there,
will Text B in addition to Text A ?
Hi David. It wasn't my first wish but if necessary it can be. It would be better if not, honestly though.
Thats fine, we have options.
Try adding this PHP Snippet tom change the text for the Pages:
add_filter( 'generate_copyright', function( $copy ) {
if ( is_page() ) {
$copy = sprintf ('© %1$s %2$s',
date('Y'),
'your pages copyright message'
);
}
return $copy;
} );
Wonderful, thanks David! Works great and I can modify it to extend it to certain posts and/or pages based on categories:
in_category('best-donut-makers') etc. :)
Awesome - glad to be of help :)