<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap-image/1.1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap-image/1.1
        http://www.sitemaps.org/schemas/sitemap-image/1.1/sitemap-image.xsd">
        
    <url>
        <loc><?php echo home_url(); ?></loc>
        <lastmod><?php echo get_lastpostmodified('Y-m-d'); ?></lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>

    <?php
    // 获取所有文章
    $args = array(
        'post_type' => 'post',
        'posts_per_page' => -1,
    );
    $posts = get_posts($args);
    foreach ($posts as $post) {
        setup_postdata($post); ?>
        <url>
            <loc><?php echo get_permalink($post); ?></loc>
            <lastmod><?php echo get_the_modified_time('Y-m-d', $post); ?></lastmod>
            <changefreq>weekly</changefreq>
            <priority>0.8</priority>
        </url>
    <?php }
    wp_reset_postdata(); ?>
</urlset>
