2

I'm looking to get the page content between the header and footer (as Wordpress already does) that includes the template HTML (as this is going to be an AJAX request).

Is there a function that will allow me to do this? The only things I have found so far all relate to just getting the content straight from the database.

It would also be great to get this content via the pages' permalink.

1
  • To what ends? You want it as a PHP variable? What are you trying to do with it? A little more context would be helpful
    – Tom J Nowell
    Commented Sep 21, 2012 at 14:35

1 Answer 1

0

Here's how to check if the current page is being loaded via an AJAX request, use this to exit from the header/footer/whichever parts

/* AJAX check  */
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  return; // it's an ajax request ABORT!!
}

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.