I'm attempting to reload the new posts using jQuery. So far as I understand, I can not reload the items in a div within the page and so i reload personal files into that div. (Is the fact that correct?)

However , my loaded file provides me with a Fatal error: Call to undefined function wordpress_mind()

How do i implement functions to some recently produced file within the theme directory to operate correctly?

This really is my jQuery

<script language="JavaScript">
$(function() {
    var SANAjax = function(){
          .load('wp-content/themes/theme/reloadhomeposts.php', function() {
    setInterval(SANAjax, 15000 );
<div id="reservationdetails"></div>

Which is things i have in reloadhomeposts.php (I've erased this content though)

<?php $recent = new WP_Query("cat=3,4,5&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>
<?php endwhile; ?>

You ought to be fine (concerning the Wordpress functionality you're missing) should you add this for your reloadhomeposts.php file before you decide to call any Wordpress function:

// ... WP_Query call and loop

Your AJAX can call /wordpress-admin/admin-ajax.php , by having an action parameter (and anything you want), then inside a wordpress plugin file you are able to connect your ajax call to :

add_action('wp_ajax_YOUR_ACTION_NAME', 'the_function_to_call');
add_action('wp_ajax_no_priv_YOUR_ACTION_NAME', 'the_function_to_call');

YOUR_ACTION_Title should be the need for the experience parameter. The first, is really a public ajax request, means you are able to refer to it as even when your not drenched in The 2nd one, need that you are drenched on.

Then your function the_function_to_call may include whatever, it'll works !

function the_function_to_call () {
    include (TEMPLATEPATH . '/reloadhomeposts.php');
    die(); // prevent string 1 to appear after

Just a little complicated but you're using Wordpress internals process for AJAX.

You are most likely getting that error since you are calling the theme file directly


since you aren't incuding the header and footer from the page.

Easy Solve:

Make certain the page loads as wanted. If you do not wish to range from the header and all sorts of that junk, you are able to load part with jQuery doing something similar to this:

  .load('wp-content/themes/theme/reloadhomeposts.php #postWrapper', function() {