<?echo '<?xml version="1.0" encoding="UTF-8"?>';?>
<rss xmlns:yandex="http://news.yandex.ru"
     xmlns:media="http://search.yahoo.com/mrss/"
     xmlns:turbo="http://turbo.yandex.ru"
     version="2.0">
    <channel>
        <title>Ветеринария и жизнь</title>
        <link>https://vetandlife.ru</link>
        <description>Краткое описание канала</description>
        <yandex:analytics id="56480275" type="Yandex"></yandex:analytics>
        <yandex:analytics id="G-VGN4NSFMW5" type="Google"></yandex:analytics>
        <yandex:adNetwork type="Yandex" id="R-A-4145099"></yandex:adNetwork>
        <language>ru</language>
        <?foreach($posts as $post):?>
            <item turbo="true">
                <turbo:extendedHtml>true</turbo:extendedHtml>
                <link><?=get_permalink($post->ID);?></link>
                <?if (isset($author) and $author !== ''):?>
                    <author><?=$author?></author>
                <?endif?>
                <category>События</category>
                <?if (has_post_thumbnail($post->ID)):?>
                    <enclosure url="<?=get_the_post_thumbnail_url($post->ID)?>" type="<?=getMimeTypeFromExtension( get_the_post_thumbnail_url($post->ID) )?>"/>
                    <?  $thumbnail_id = get_post_thumbnail_id($post->ID);
                        $image_data = wp_get_attachment_image_src($thumbnail_id, 'full');
                        $image_caption = get_post($thumbnail_id)->post_excerpt;
                        $figure = '<figure><img src="'.get_the_post_thumbnail_url($post->ID).'"><figcaption>'.$image_caption.'</figcaption> </figure>';?>
                 <?else:
                    $figure = '';   
                endif?>                   
                <pubDate><?=_U2RFC822($post->post_date)?></pubDate>
                <turbo:content><![CDATA[<header><h1><?=htmlspecialchars($post->post_title)?></h1><?=$figure?></header><p><?=htmlspecialchars($post->post_excerpt)?></p><?=filtercontent($post->post_contentt);?><p>Добавляйте ВиЖ в свои источники в <a href="https://dzen.ru/vetandlife?favid=254162793">Дзен</a> и <a href="https://t.me/ViZHuvizh">Телеграм</a></p>]]></turbo:content>
            </item>                
        <?endforeach?>    
    </channel>
</rss>    
