How to Include WordPress Header and Footer in non-WordPress php file

I have a WordPress site but its Registration Page (which is integrated with PayPal) is not part of the WordPress site (Some other developer is doing this and it’s in PHP). Now the problem is whenever I change some bits in the footer or the header (especially the links), I will need to download this external PHP file, change the links there too and then upload it again.

It’s a tedious task and prone to mistakes. They won’t let me handle the registration form in WordPress so I’m stuck with this workflow for now.

Read More

Can I include my WordPress footer and header within their PHP file so that we are just using the same file?

Related posts

Leave a Reply

1 comment

  1. You can pull wordpress stuffs by doing

    require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
    

    NOTE in this example the wordpress install is in the document root of the site. If, for example, your wordpress is installed as yourdomain.com/wordpress/ then modify the above code to

    require($_SERVER['DOCUMENT_ROOT'].'/wordpress/wp-load.php');
    

    Then you are clear to use wordpress functions and can pull the header like this:

    get_header();
    

    And footer:

    get_footer();