Archived topic
Execute php in elements not working
7 replies · Started by Tesco on July 30, 2022
I'm trying to execute php in hooks but this is not working.
I'm on localhost and I already disabled all plugins...
Hi there,
Not sure if I fully understand.
What exactly isn't working or what code are you adding?
GP does not have any control over whether your code works or not.
Let me know :)
Why is this code not echoing on my hook element: <?php echo 'HOME PHP';?>
generate_after_entry_title »» All pages
For Pages you need to use the generate_after_entry_header
See here for where the hooks are located:
https://docs.generatepress.com/article/hooks-visual-guide/#static-page
Thanks, but not working also!
Just to confirm, the display rule All Pages does not include the home page - this is the way WordPress conditional tags work:
https://codex.wordpress.org/Conditional_Tags
So if that code is supposed to be working on the home page then you would need to add Front page to the display rules as well.
That makes sense.
Thanks!
No problem :)