[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> feed-atom.php (source)

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


Generated : Fri Sep 4 08:20:24 2026 Cross-referenced by PHPXref