Title: Programmatically include header code
Last modified: May 31, 2024

---

# Programmatically include header code

 *  Resolved [lagzer](https://wordpress.org/support/users/lagzer/)
 * (@lagzer)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/programmatically-include-header-code/)
 * Hello! First of all, thanks for a good product.
 * We have a website and on some pages we don’t run the standard WordPress headers
   and footers. We however still would like our header & footer code from your plugin
   to run.
 * Is there a way to manually call in the code in the** “Header”** or **“Footer”**-
   field in the **“Global Header and Footer”** section using PHP?
 * Thank you in advance!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Mircea Sandu](https://wordpress.org/support/users/gripgrip/)
 * (@gripgrip)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/programmatically-include-header-code/#post-17793801)
 * Hi [@lagzer](https://wordpress.org/support/users/lagzer/),
 * Yes, you can do that using the function `wpcode_global_frontend_header()` for
   the header code and `wpcode_global_frontend_footer()` for the footer.
 * Please add function_exists checks in the code if you plan on adding these to 
   your template files directly.
 * Instead of that, I recommend creating a new PHP snippet in WPCode, set it to 
   Shortcode mode and in the code area simply add `wpcode_global_frontend_header()`(
   do the same for footer with another snippet) and then use the WPCode Shortcode
   to insert the snippet where needed if that’s an option. This way, if you ever
   deactivate the plugin for some reason you will not run into a fatal error.
 *  Thread Starter [lagzer](https://wordpress.org/support/users/lagzer/)
 * (@lagzer)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/programmatically-include-header-code/#post-17793853)
 * This is exactly what I was looking for. Thank you for your quick reply and thoughtful
   advice.
 * Have a good day!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Programmatically include header code’ is closed to new replies.

 * ![](https://ps.w.org/insert-headers-and-footers/assets/icon-256x256.png?rev=2758516)
 * [WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager](https://wordpress.org/plugins/insert-headers-and-footers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-headers-and-footers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-headers-and-footers/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-headers-and-footers/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [programatically](https://wordpress.org/support/topic-tag/programatically/)

 * 2 replies
 * 2 participants
 * Last reply from: [lagzer](https://wordpress.org/support/users/lagzer/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/programmatically-include-header-code/#post-17793853)
 * Status: resolved