• Resolved lagzer

    (@lagzer)


    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

    (@gripgrip)

    Hi @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

    (@lagzer)

    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)
  • You must be logged in to reply to this topic.