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