/wp-includes/feed-atom.php

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