| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Atom Feed Template for displaying Atom Comments feed. 4 * 5 * @package WordPress 6 */ 7 8 header( 'Content-Type: ' . feed_content_type( 'atom' ) . '; charset=' . get_option( 'blog_charset' ), true ); 9 echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '" ?' . '>'; 10 11 /** This action is documented in wp-includes/feed-rss2.php */ 12 do_action( 'rss_tag_pre', 'atom-comments' ); 13 ?> 14 <feed 15 xmlns="http://www.w3.org/2005/Atom" 16 xml:lang="<?php bloginfo_rss( 'language' ); ?>" 17 <?php 18 wp_feed_namespaces( 'atom-comments' ); 19 20 /** This action is documented in wp-includes/feed-atom.php */ 21 do_action( 'atom_ns' ); 22 23 /** 24 * Fires inside the feed tag in the Atom comment feed. 25 * 26 * Consider using the {@see 'wp_feed_namespaces'} filter instead, which 27 * prevents duplicate `xmlns` attributes. 28 * 29 * @since 2.8.0 30 */ 31 do_action( 'atom_comments_ns' ); 32 ?> 33 > 34 <title type="text"> 35 <?php 36 if ( is_singular() ) { 37 /* translators: Comments feed title. %s: Post title. */ 38 printf( ent2ncr( __( 'Comments on %s' ) ), get_the_title_rss() ); 39 } elseif ( is_search() ) { 40 /* translators: Comments feed title. 1: Site title, 2: Search query. */ 41 printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() ); 42 } else { 43 /* translators: Comments feed title. %s: Site title. */ 44 printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() ); 45 } 46 ?> 47 </title> 48 <subtitle type="text"><?php bloginfo_rss( 'description' ); ?></subtitle> 49 50 <updated><?php echo get_feed_build_date( 'Y-m-d\TH:i:s\Z' ); ?></updated> 51 52 <?php if ( is_singular() ) : ?> 53 <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php comments_link_feed(); ?>" /> 54 <link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link( '', 'atom' ) ); ?>" /> 55 <id><?php echo esc_url( get_post_comments_feed_link( '', 'atom' ) ); ?></id> 56 <?php elseif ( is_search() ) : ?> 57 <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" /> 58 <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link( '', 'atom' ); ?>" /> 59 <id><?php echo get_search_comments_feed_link( '', 'atom' ); ?></id> 60 <?php else : ?> 61 <link rel="alternate" type="<?php bloginfo_rss( 'html_type' ); ?>" href="<?php bloginfo_rss( 'url' ); ?>" /> 62 <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss( 'comments_atom_url' ); ?>" /> 63 <id><?php bloginfo_rss( 'comments_atom_url' ); ?></id> 64 <?php endif; ?> 65 <?php 66 /** 67 * Fires at the end of the Atom comment feed header. 68 * 69 * @since 2.8.0 70 */ 71 do_action( 'comments_atom_head' ); 72 ?> 73 <?php 74 while ( have_comments() ) : 75 the_comment(); 76 $comment_post = get_post( $comment->comment_post_ID ); 77 /** 78 * @global WP_Post $post Global post object. 79 */ 80 $GLOBALS['post'] = $comment_post; 81 ?> 82 <entry> 83 <title> 84 <?php 85 if ( ! is_singular() ) { 86 $title = get_the_title( $comment_post->ID ); 87 /** This filter is documented in wp-includes/feed.php */ 88 $title = apply_filters( 'the_title_rss', $title ); 89 /* translators: Individual comment title. 1: Post title, 2: Comment author name. */ 90 printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() ); 91 } else { 92 /* translators: Comment author title. %s: Comment author name. */ 93 printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() ); 94 } 95 ?> 96 </title> 97 <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" /> 98 99 <author> 100 <name><?php comment_author_rss(); ?></name> 101 <?php 102 if ( get_comment_author_url() ) { 103 echo '<uri>' . get_comment_author_url() . '</uri>'; 104 } 105 ?> 106 107 </author> 108 109 <id><?php comment_guid(); ?></id> 110 <updated><?php echo mysql2date( 'Y-m-d\TH:i:s\Z', get_comment_time( 'Y-m-d H:i:s', true, false ), false ); ?></updated> 111 <published><?php echo mysql2date( 'Y-m-d\TH:i:s\Z', get_comment_time( 'Y-m-d H:i:s', true, false ), false ); ?></published> 112 113 <?php if ( post_password_required( $comment_post ) ) : ?> 114 <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content> 115 <?php else : ?> 116 <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content> 117 <?php endif; // End if post_password_required(). ?> 118 119 <?php 120 // Return comment threading information (https://www.ietf.org/rfc/rfc4685.txt). 121 if ( '0' === $comment->comment_parent ) : // This comment is top-level. 122 ?> 123 <thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss(); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" /> 124 <?php 125 else : // This comment is in reply to another comment. 126 $parent_comment = get_comment( $comment->comment_parent ); 127 /* 128 * The rel attribute below and the id tag above should be GUIDs, 129 * but WP doesn't create them for comments (unlike posts). 130 * Either way, it's more important that they both use the same system. 131 */ 132 ?> 133 <thr:in-reply-to ref="<?php comment_guid( $parent_comment ); ?>" href="<?php echo get_comment_link( $parent_comment ); ?>" type="<?php bloginfo_rss( 'html_type' ); ?>" /> 134 <?php 135 endif; 136 137 /** 138 * Fires at the end of each Atom comment feed item. 139 * 140 * @since 2.2.0 141 * 142 * @param int $comment_id ID of the current comment. 143 * @param int $comment_post_id ID of the post the current comment is connected to. 144 */ 145 do_action( 'comment_atom_entry', $comment->comment_ID, $comment_post->ID ); 146 ?> 147 </entry> 148 <?php 149 endwhile; 150 ?> 151 </feed>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Thu Sep 3 08:20:25 2026 | Cross-referenced by PHPXref |