<?php header('Content-Type: text/xml');
        echo '<'.'?xml version="1.0" encoding="UTF-8"?'.'>' ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php
        ini_set('display_errors', 1);
        error_reporting(E_ERROR);

        define('WP_USE_THEMES', false);
        define( 'SHORTINIT', false );


        require_once('wp-load.php');
        $args = array(
            'post_type' => array('page','post'),
            'post_status' => 'publish',
            'posts_per_page' => -1
        );
        $posts = get_posts($args);

        foreach($posts as $p) {
            echo '    <url>'."\n";
            echo '      <loc>'.get_the_permalink($p->ID).'</loc>'."\n";
            echo '      <lastmod>'.str_replace(strstr($p->post_modified ,' '),'',$p->post_modified).'</lastmod>'."\n";
            echo '    </url>'."\n";
        }
?>
</urlset>
