Archived topic
PHP file and code dissapeared after theme update
3 replies · Started by George on March 26, 2023
Hello, I have inserted some PHP code in the GP folder so I can use custom shortcodes on the content of my site that retrieve the date, month and year. However, this file was removed when GP was updated and my front end broke. It was suggested to me to either create a child theme and use the code there, and use some code insertion plugin. My questions:
1. which of the 2 options is better in terms of pagespeed & SEO efficiency?
2. Can I use a GP hook to inject the PHP into all pages? Is this option better than using the child theme and in what ways?
Hi there,
1. In general there should be no noticeable performance differences between child theme or plugin.
And neither option has any bearing on SEO.
2. GP Hooks should only be used to add content into the template. So they cannot be used to replace the kind of codes that need to go in functions.php file
Thanks David. What's your recommendation for a free PHP code insertion plugin?
Learn how to add PHP: https://docs.generatepress.com/article/adding-php/