ajax request with permalinks on breaks wordpress loop
-
Hey Guys,
We have a jquery carousel installed on our wordpress home page.
The images for the carousel come via an ajax call from an array which is created using php after cycling through the wordpress posts.Without permalinks turned on the carousel works great.
However after any type of permalink are turned on in wordpress my
if (have_posts()) : while (have_posts()) : the_post(); endwhile; endif;
loop stops working. The page that is loaded via ajax simply no longer receiving any results back.
The following is the php file that is loaded using a jquery ajax call.
<?php require('../pcd/wp-blog-header.php'); // Array indexes are 0-based, jCarousel positions are 1-based. $first = max(0, intval($_GET['first']) - 1); $last = max($first + 1, intval($_GET['last']) - 1); $length = $last - $first + 1; // --- if (have_posts()) : while (have_posts()) : the_post(); if (get_custom('featured') == 'true'){ $details[] = array ( "details" => array ( "image" => get_custom('featured_img'), "title" => get_the_title(), "link" => get_permalink(), ) ); } endwhile; endif; $total = count($details); $selected = array_slice($details, $first, $length); // --- header('Content-Type: text/xml'); echo '<data>'; // Return total number of images so the callback // can set the size of the carousel. echo ' <total>' . $total . '</total>'; foreach ($selected as $img) { echo '<item>'; echo '<title>'; echo $img["details"]["title"]; echo '</title>'; echo '<link>'; echo $img["details"]["link"]; echo '</link>'; echo '<image>'; echo $img["details"]["image"]; echo '</image>'; echo '</item>'; } echo '</data>'; ?>
Does any one have any ideas? The following link shows our work so far and maybe using firebug you can see the server responce.
https://wp.paulchang.comMany many thanks
Dan
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘ajax request with permalinks on breaks wordpress loop’ is closed to new replies.