• I am trying to implement this into my site. A specific div that will refresh a list of posts every 10 seconds or so. So far, the code is working perfectly, it refreshes the div just fine.

    This is what I have in the header.php file.

    <?php wp_enqueue_script("jquery"); ?>
    
    <script>
    var auto_refresh = setInterval(
    function()
    {
    $('#loaddiv').fadeOut('slow').load('/wp-content/themes/mysite/get_posts.php').fadeIn("slow");
    }, 20000);
    </script>

    This is all before wp_head().

    Here is the problem I am encountering: Since the file is being pulled through the jquery function, the wordpress core functions no longer work. I get this error: Fatal Error: Call to undefined function query_posts….

    I have searched all over the net…many people suggest adding an include for wp-load.php or wp-blog-header.php but the problem I run into there is that wordpress will not let you call those files directly so I get another fatal error.

    Any help would be appreciated.

The topic ‘Auto Refresh Div – Fatal Error’ is closed to new replies.