rss.php
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* XML template for the RSS Sitemap.
*
* @since 4.0.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// phpcs:disable
?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel><?php
if ( ! $isYandexBot ) {
?>
<title><?php aioseo()->sitemap->output->escapeAndEcho( $title, false ); ?></title>
<link><?php aioseo()->sitemap->output->escapeAndEcho( $link ); ?></link>
<?php if ( $description ) {
?><description><?php aioseo()->sitemap->output->escapeAndEcho( $description ); ?></description>
<?php }
?><?php if ( ! empty( $entries[0]['pubDate'] ) ) {
?><lastBuildDate><?php aioseo()->sitemap->output->escapeAndEcho( $entries[0]['pubDate'] ); ?></lastBuildDate>
<?php }
?><docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<atom:link href="<?php echo aioseo()->sitemap->helpers->getUrl( 'rss' ); ?>" rel="self" type="application/rss+xml" />
<ttl><?php aioseo()->sitemap->output->escapeAndEcho( $ttl ); ?></ttl>
<?php }
foreach ( $entries as $entry ) {
if ( empty( $entry['guid'] ) ) {
continue;
}?>
<item>
<guid><?php aioseo()->sitemap->output->escapeAndEcho( $entry['guid'] ); ?></guid>
<link><?php aioseo()->sitemap->output->escapeAndEcho( $entry['guid'] ); ?></link><?php
if ( ! empty( $entry['title'] ) ) {
?>
<title><?php aioseo()->sitemap->output->escapeAndEcho( $entry['title'], false ); ?></title><?php
}
if ( ! empty( $entry['pubDate'] ) ) {
?>
<pubDate><?php aioseo()->sitemap->output->escapeAndEcho( $entry['pubDate'] ); ?></pubDate><?php
}
?>
</item>
<?php } ?>
</channel>
</rss>