dragunoff

[WP] AJAX or not template

Dec 16th, 2011
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2. /* Page requested via AJAX  */
  3. if ( ! empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
  4.  
  5.     // the loop
  6.     if ( have_posts() ) : while ( have_posts() ) : the_post();
  7.         // template tags
  8.     endwhile; endif;
  9.    
  10. /* Page requested via regular HTTP */
  11. } else {
  12.    
  13.     get_header()
  14.  
  15.     // the loop
  16.     if ( have_posts() ) : while ( have_posts() ) : the_post();
  17.         // template tags
  18.     endwhile; endif;
  19.    
  20.     get_footer();
  21.    
  22. }
Advertisement
Add Comment
Please, Sign In to add comment