Archived topic
Can you execute PHP in a header element?
5 replies · Started by Clayton on November 1, 2018
Hey guys,
Is is possible or advisable to execute PHP in a header element? Also, I'm gettin this error on the php in a hook option: DISALLOW_FILE_EDIT. Hosting on WPEngine.
Hi there,
Not sure what code you are trying to execute but our general recommendation is to create a shortcode for it: https://generatepress.com/forums/topic/page-header-for-search-results/#post-403642
As for the DISALLOW_FILE_EDIT note, see the Execute PHP and the link to the WordPress page for more info:
https://docs.generatepress.com/article/hooks-element-overview/#settings
Let me know if this helps :)
Shortcode option worked great! Just to clarify will PHP execute if I didn't use a shortcode?
No - PHP can only be added in Hooks :)
Awesome, thanks for clarifying Tom. By the way I am really enjoying GeneratePress. You've made a very slick theme. Love the simplicity and speed!
Great to hear! Thanks! :)