<?php // Handle the ajax pagination when using the default permalink structure // ie. www.site.com/?page=XXX $dir = dirname(__FILE__); $base_dir = substr($dir, 0, strpos($dir, DIRECTORY_SEPARATOR . 'wp-content')); require $base_dir . '/wp-blog-header.php'; if (isset($_GET['wpv-ajax-pagination'])) { $post_data = pack('H*', $_GET['wpv-ajax-pagination']); $post_data = json_decode($post_data, true); header('HTTP/1.0 200 OK'); header('Content-Type: text/css'); echo '<html><body>'; wpv_ajax_get_page($post_data); echo '</body></html>'; $wp_query->is_404 = false; exit; }
function wpv_pagination_router() { global $wp_query; $bits = explode("/", $_SERVER['REQUEST_URI']); for ($i = 0; $i < count($bits) - 1; $i++) { if ($bits[$i] == 'wpv-ajax-pagination') { // get the post data. It's hex encoded json $post_data = $bits[$i + 1]; $post_data = pack('H*', $post_data); $post_data = json_decode($post_data, true); header('HTTP/1.0 200 OK'); header('Content-Type: text/css'); echo '<html><body>'; wpv_ajax_get_page($post_data); echo '</body></html>'; $wp_query->is_404 = false; exit; } } }
function wpv_pagination_router() { $bits = explode( "/", esc_attr( $_SERVER['REQUEST_URI'] ) ); for ( $i = 0; $i < count( $bits ) - 1; $i++ ) { if ( $bits[$i] == 'wpv-ajax-pagination' ) { // get the post data. It's hex encoded json $post_data = $bits[$i + 1]; $post_data = pack( 'H*', $post_data ); $post_data = json_decode( $post_data, true ); $charset = get_bloginfo( 'charset' ); global $wp_query; if ( $wp_query->is_404 ) { $wp_query->is_404 = false; } header( 'HTTP/1.1 200 OK' ); header( 'Content-Type: text/html;charset=' . $charset ); echo '<html><body>'; wpv_ajax_get_page( $post_data ); echo '</body></html>'; exit; } } }