• I’m trying to make a section of my page refresh every few minutes to display updated content but am struggling.

    I run a football blog and on matchdays we have live match discussion. On the sidebar we have match information brought in through a custom field. I want that data to automatically refresh without our users having to refresh the whole page.

    The java I am using refreshes non-loop content fine but when I try to put in a call for custom fields it has an issue. First load is fine, but it displays an error after the refresh. Error and code below. Any ideas?

    https://nonaynever.net/4290/live-blog-burnley-vs-cardiff-city/

    ERROR
    FATAL ERROR: CALL TO UNDEFINED FUNCTION GET_POST_META() IN /HOME/KEVRCOUK/PUBLIC_HTML/NNN/WP-CONTENT/THEMES/THEMORNINGAFTER/LIVETEAMS.PHP ON LINE 2

    Header.php
    <script>
    setInterval(function(){
    $(“#scores”).load(“<?php bloginfo(‘template_directory’);?>/liveteams.php #scores”);
    }, 30000);
    </script>

    liveteams.php
    <div id=”scores”>
    <div class=”column span-3 first”><p class=”team”><?php echo get_post_meta($post->ID, ‘homelineup’, true); ?></p></div>
    <div class=”column span-3 first”><p class=”team”><?php echo get_post_meta($post->ID, ‘awaylineup’, true); ?></p></div>
    .
    </div>

  • The topic ‘Refreshing a loop’ is closed to new replies.