0

I set up my blog so that some of my posts get linked to a page outside of Wordpress. For these posts that get linked outside of Wordpress, I'd like to still include my header and footer so the page looks like it's still a part of my site. What would be the best way to do this?

I tried adding <?php include("/path/to/header.php"); ?> and <?php include("/path/to/footer.php"); ?> but obviously it wouldn't work since my header and footer files contain Wordpress conditional tags.

1 Answer 1

0

You'll either need to load in WordPress, which can be considered computationally expensive if your 'other' pages are also powered by another webapp (not to mention the conflicts it may bring).

If they're just regular PHP files, you should be OK.

To load WordPress, include the file /path/to/wordpress/wp-load.php, then you'll be able to use WordPress as you would normally, including things like get_header() and get_footer().

However, whilst perhaps not the most 'compact' solution, my best advice would be to create header and footer files for these other pages that replicate the HTML of your theme without WordPress-specific PHP functions, and include them instead.

1
  • Thanks, I think I'll just replicate the html without wp specific functions.
    – jwp
    Commented Mar 13, 2011 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.