Archived topic
Problems when I add php code with Snippets
1 reply · Started by yan on May 14, 2019
Hi,
I want to add copyrights information to every post.
So I add a filter via the Snippets plugin and the code is:
-----------------
function add_copyright_to_post($content){
if(is_single() or is_feed()) {
$content .= "some copyrights words";
return $content;
}
}
add_filter('the_content', 'add_copyright_to_post');
-----------------
Then the "some copyrights words" are displayed at the bottom of every post single page.
But I got a display problems at the index page.
The entry-content and read-more-container are disappeared!!!
Please help me to solve this problem.
Thank you very much.
Hi there,
might be easier if you use the GP Hooks:
https://docs.generatepress.com/article/hooks-visual-guide/
You can use the Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/