Skip to content

Instantly share code, notes, and snippets.

@roborourke
Created November 22, 2012 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roborourke/4130750 to your computer and use it in GitHub Desktop.
Save roborourke/4130750 to your computer and use it in GitHub Desktop.
Hide get_header() and get_footer() calls when loading wp URLs not via wp ajax
// makes sure every ajax request has the 'is_ajax' parameter sent whether its using the WP ajax API or not
$.ajaxSetup( {
data: { is_ajax: 1 }
} );
<?php
// can't find a neater solution :(
if ( ! isset( $_REQUEST['is_ajax'] ) ) get_header();
if ( ! isset( $_REQUEST['is_ajax'] ) ) get_footer();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment