author | ymh <ymh.work@gmail.com> |
Mon, 08 Sep 2025 19:44:41 +0200 | |
changeset 23 | 417f20492bf7 |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* RSS2 Feed Template for displaying RSS2 Comments feed. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
*/ |
|
7 |
||
9 | 8 |
header( 'Content-Type: ' . feed_content_type( 'rss2' ) . '; charset=' . get_option( 'blog_charset' ), true ); |
0 | 9 |
|
9 | 10 |
echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>'; |
5 | 11 |
|
12 |
/** This action is documented in wp-includes/feed-rss2.php */ |
|
13 |
do_action( 'rss_tag_pre', 'rss2-comments' ); |
|
0 | 14 |
?> |
15 |
<rss version="2.0" |
|
16 |
xmlns:content="http://purl.org/rss/1.0/modules/content/" |
|
17 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
18 |
xmlns:atom="http://www.w3.org/2005/Atom" |
|
19 |
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" |
|
20 |
<?php |
|
21 |
/** This action is documented in wp-includes/feed-rss2.php */ |
|
22 |
do_action( 'rss2_ns' ); |
|
23 |
?> |
|
24 |
||
25 |
<?php |
|
26 |
/** |
|
27 |
* Fires at the end of the RSS root to add namespaces. |
|
28 |
* |
|
29 |
* @since 2.8.0 |
|
30 |
*/ |
|
31 |
do_action( 'rss2_comments_ns' ); |
|
32 |
?> |
|
33 |
> |
|
34 |
<channel> |
|
9 | 35 |
<title> |
36 |
<?php |
|
37 |
if ( is_singular() ) { |
|
16 | 38 |
/* translators: Comments feed title. %s: Post title. */ |
9 | 39 |
printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() ); |
40 |
} elseif ( is_search() ) { |
|
16 | 41 |
/* translators: Comments feed title. 1: Site title, 2: Search query. */ |
9 | 42 |
printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() ); |
43 |
} else { |
|
16 | 44 |
/* translators: Comments feed title. %s: Site title. */ |
9 | 45 |
printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() ); |
46 |
} |
|
47 |
?> |
|
48 |
</title> |
|
0 | 49 |
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> |
9 | 50 |
<link><?php ( is_single() ) ? the_permalink_rss() : bloginfo_rss( 'url' ); ?></link> |
51 |
<description><?php bloginfo_rss( 'description' ); ?></description> |
|
52 |
<lastBuildDate><?php echo get_feed_build_date( 'r' ); ?></lastBuildDate> |
|
53 |
<sy:updatePeriod> |
|
54 |
<?php |
|
5 | 55 |
/** This filter is documented in wp-includes/feed-rss2.php */ |
56 |
echo apply_filters( 'rss_update_period', 'hourly' ); |
|
9 | 57 |
?> |
58 |
</sy:updatePeriod> |
|
59 |
<sy:updateFrequency> |
|
60 |
<?php |
|
5 | 61 |
/** This filter is documented in wp-includes/feed-rss2.php */ |
62 |
echo apply_filters( 'rss_update_frequency', '1' ); |
|
9 | 63 |
?> |
64 |
</sy:updateFrequency> |
|
0 | 65 |
<?php |
66 |
/** |
|
67 |
* Fires at the end of the RSS2 comment feed header. |
|
68 |
* |
|
69 |
* @since 2.3.0 |
|
70 |
*/ |
|
71 |
do_action( 'commentsrss2_head' ); |
|
72 |
||
16 | 73 |
while ( have_comments() ) : |
74 |
the_comment(); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
75 |
$comment_post = get_post( $comment->comment_post_ID ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
76 |
/** |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
77 |
* @global WP_Post $post Global post object. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
78 |
*/ |
16 | 79 |
$GLOBALS['post'] = $comment_post; |
80 |
?> |
|
81 |
<item> |
|
82 |
<title> |
|
83 |
<?php |
|
84 |
if ( ! is_singular() ) { |
|
85 |
$title = get_the_title( $comment_post->ID ); |
|
86 |
/** This filter is documented in wp-includes/feed.php */ |
|
87 |
$title = apply_filters( 'the_title_rss', $title ); |
|
88 |
/* translators: Individual comment title. 1: Post title, 2: Comment author name. */ |
|
89 |
printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() ); |
|
90 |
} else { |
|
91 |
/* translators: Comment author title. %s: Comment author name. */ |
|
92 |
printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() ); |
|
93 |
} |
|
94 |
?> |
|
95 |
</title> |
|
96 |
<link><?php comment_link(); ?></link> |
|
97 |
||
9 | 98 |
<dc:creator><![CDATA[<?php echo get_comment_author_rss(); ?>]]></dc:creator> |
99 |
<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_comment_time( 'Y-m-d H:i:s', true, false ), false ); ?></pubDate> |
|
100 |
<guid isPermaLink="false"><?php comment_guid(); ?></guid> |
|
16 | 101 |
|
102 |
<?php if ( post_password_required( $comment_post ) ) : ?> |
|
103 |
<description><?php echo ent2ncr( __( 'Protected Comments: Please enter your password to view comments.' ) ); ?></description> |
|
104 |
<content:encoded><![CDATA[<?php echo get_the_password_form(); ?>]]></content:encoded> |
|
105 |
<?php else : ?> |
|
106 |
<description><![CDATA[<?php comment_text_rss(); ?>]]></description> |
|
107 |
<content:encoded><![CDATA[<?php comment_text(); ?>]]></content:encoded> |
|
108 |
<?php endif; // End if post_password_required(). ?> |
|
109 |
||
110 |
<?php |
|
111 |
/** |
|
112 |
* Fires at the end of each RSS2 comment feed item. |
|
113 |
* |
|
114 |
* @since 2.1.0 |
|
115 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
116 |
* @param int $comment_id The ID of the comment being displayed. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
117 |
* @param int $comment_post_id The ID of the post the comment is connected to. |
16 | 118 |
*/ |
119 |
do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID ); |
|
9 | 120 |
?> |
16 | 121 |
</item> |
122 |
<?php endwhile; ?> |
|
0 | 123 |
</channel> |
124 |
</rss> |