Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
Thanks, I think I'll just replicate the html without wp specific functions. –  jwp Mar 13 '11 at 2:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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