1<?php
2/**
3 * Atom Feed Template for displaying Atom Posts feed.
4 *
5 * @package WordPress
6 */
7
8// Don't load directly.
9if ( ! defined( 'ABSPATH' ) ) {
10 die( '-1' );
11}
12
13header( 'Content-Type: ' . feed_content_type( 'atom' ) . '; charset=' . get_option( 'blog_charset' ), true );
14$more = 1;
15
16echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
17
18/** This action is documented in wp-includes/feed-rss2.php */
19do_action( 'rss_tag_pre', 'atom' );
20?>
21<feed
22 xmlns="http://www.w3.org/2005/Atom"
23 xmlns:thr="http://purl.org/syndication/thread/1.0"
24 xml:lang="<?php bloginfo_rss( 'language' ); ?>"
25 <?php
26 /**
27 * Fires at end of the Atom feed root to add namespaces.
28 *
29 * @since 2.0.0
30 */
31 do_action( 'atom_ns' );
32 ?>
33>
34 <title type="text"><?php wp_title_rss(); ?></title>
35 <subtitle type="text"><?php bloginfo_rss( 'description' ); ?></subtitle>
36
37 <updated><?php echo get_feed_build_date( 'Y-m-d\TH:i:s\Z' ); ?></updated>
38
39 <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php bloginfo_rss( 'url' ); ?>" />
40 <id><?php bloginfo( 'atom_url' ); ?></id>
41 <link rel="self" type="application/atom+xml" href="<?php self_link(); ?>" />
42
43 <?php
44 /**
45 * Fires just before the first Atom feed entry.
46 *
47 * @since 2.0.0
48 */
49 do_action( 'atom_head' );
50
51 while ( have_posts() ) :
52 the_post();
53 ?>
54 <entry>
55 <author>
56 <name><?php the_author(); ?></name>
57 <?php
58 $author_url = get_the_author_meta( 'url' );
59 if ( ! empty( $author_url ) ) :
60 ?>
61 <uri><?php the_author_meta( 'url' ); ?></uri>
62 <?php
63 endif;
64
65 /**
66 * Fires at the end of each Atom feed author entry.
67 *
68 * @since 3.2.0
69 */
70 do_action( 'atom_author' );
71 ?>
72 </author>
73
74 <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss(); ?>]]></title>
75 <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php the_permalink_rss(); ?>" />
76
77 <id><?php the_guid(); ?></id>
78 <updated><?php echo get_post_modified_time( 'Y-m-d\TH:i:s\Z', true ); ?></updated>
79 <published><?php echo get_post_time( 'Y-m-d\TH:i:s\Z', true ); ?></published>
80 <?php the_category_rss( 'atom' ); ?>
81
82 <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
83
84 <?php if ( ! get_option( 'rss_use_excerpt' ) ) : ?>
85 <content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss(); ?>"><![CDATA[<?php the_content_feed( 'atom' ); ?>]]></content>
86 <?php endif; ?>
87
88 <?php
89 atom_enclosure();
90
91 /**
92 * Fires at the end of each Atom feed item.
93 *
94 * @since 2.0.0
95 */
96 do_action( 'atom_entry' );
97
98 if ( get_comments_number() || comments_open() ) :
99 ?>
100 <link rel="replies" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php the_permalink_rss(); ?>#comments" thr:count="<?php echo get_comments_number(); ?>" />
101 <link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link( 0, 'atom' ) ); ?>" thr:count="<?php echo get_comments_number(); ?>" />
102 <thr:total><?php echo get_comments_number(); ?></thr:total>
103 <?php endif; ?>
104 </entry>
105 <?php endwhile; ?>
106</feed>
107