Files
vij/views/rss/yanews.php

30 lines
1.4 KiB
PHP
Raw Normal View History

2021-10-11 22:29:11 +03:00
<?echo '<?xml version="1.0" encoding="UTF-8"?>';?>
<rss xmlns:yandex="http://news.yandex.ru" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<title>Новости с сайта www.vetandlife.ru</title>
<link>https://www.vetandlife.ru</link>
<description>Новости с сайта www.vetandlife.ru</description>
<?foreach($posts as $post):?>
<item>
<title><?=htmlspecialchars($post->post_title)?></title>
<link><?=get_permalink($post->ID);?></link>
<description><?=htmlspecialchars($post->post_excerpt);?></description>
<?$category=get_the_category($post->ID);?>
<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>
<yandex:full-text><![CDATA[
<?=trim($post->post_content)?>
]]>
</yandex:full-text>
</item>
<?endforeach?>
</channel>
</rss>