<?echo '<?xml version="1.0" encoding="UTF-8"?>';?>
<rss version="2.0">
    <channel>
        <language>ru</language>
        <copyright><?=date('Y')?>, Ветеринария и жизнь</copyright>
        <title>Новости с сайта www.vetandlife.ru</title>
        <link>https://www.vetandlife.ru</link>
        <lastBuildDate><?=_U2RFC822(date('Y-m-d h:i:s'))?></lastBuildDate>
        <description>Новости с сайта www.vetandlife.ru</description>
        <image>
            <url>https://vetandlife.ru/wp-content/themes/vij/pub/vij.png</url>
            <title>Ветеринария и жизнь</title>
            <link>https://www.vetandlife.ru</link>
        </image>
        <?foreach($posts as $post):?>
            <item>
                <title><?=htmlspecialchars($post->post_title)?></title>
                <guid><?=get_permalink($post->ID);?></guid>
                <description><?=htmlspecialchars($post->post_excerpt);?></description>
                <?$category=get_the_category($post->ID);?>
                <category><?=$category?></category>
                <?$author = get_the_author($post->ID);?>
                <?if (isset($author) and $author !== ''):?>
                    <author><?=$author?></author>
                <?endif?>
                <?if (has_post_thumbnail($post->ID)):?>
                <enclosure url="<?=get_the_post_thumbnail_url($post->ID)?>" type="image/jpeg"/>  
                <?endif?>              
                <pubDate><?=_U2RFC822($post->post_date)?></pubDate>
                <description><![CDATA[<?=strip_tags($post->post_content)?>]]></description>
            </item>                
        <?endforeach?>    
    </channel>
</rss>    
