| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * RSS2 Feed Template for displaying RSS2 Posts feed. 4 * 5 * @package WordPress 6 */ 7 8 header( 'Content-Type: ' . feed_content_type( 'rss2' ) . '; charset=' . get_option( 'blog_charset' ), true ); 9 $more = 1; 10 11 echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>'; 12 13 /** 14 * Fires between the xml and rss tags in a feed. 15 * 16 * @since 4.0.0 17 * 18 * @param string $context Type of feed. Possible values include 'rss2', 'rss2-comments', 19 * 'rdf', 'atom', and 'atom-comments'. 20 */ 21 do_action( 'rss_tag_pre', 'rss2' ); 22 ?> 23 <rss version="2.0" 24 <?php 25 wp_feed_namespaces( 'rss2' ); 26 27 /** 28 * Fires at the end of the RSS 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( 'rss2_ns' ); 36 ?> 37 > 38 39 <channel> 40 <title><?php wp_title_rss(); ?></title> 41 <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> 42 <link><?php bloginfo_rss( 'url' ); ?></link> 43 <description><?php bloginfo_rss( 'description' ); ?></description> 44 <lastBuildDate><?php echo get_feed_build_date( 'r' ); ?></lastBuildDate> 45 <language><?php bloginfo_rss( 'language' ); ?></language> 46 <sy:updatePeriod> 47 <?php 48 $duration = 'hourly'; 49 50 /** 51 * Filters how often to update the RSS feed. 52 * 53 * @since 2.1.0 54 * 55 * @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly', 56 * 'yearly'. Default 'hourly'. 57 */ 58 echo apply_filters( 'rss_update_period', $duration ); 59 ?> 60 </sy:updatePeriod> 61 <sy:updateFrequency> 62 <?php 63 $frequency = '1'; 64 65 /** 66 * Filters the RSS update frequency. 67 * 68 * @since 2.1.0 69 * 70 * @param string $frequency An integer passed as a string representing the frequency 71 * of RSS updates within the update period. Default '1'. 72 */ 73 echo apply_filters( 'rss_update_frequency', $frequency ); 74 ?> 75 </sy:updateFrequency> 76 <?php 77 /** 78 * Fires at the end of the RSS2 Feed Header. 79 * 80 * @since 2.0.0 81 */ 82 do_action( 'rss2_head' ); 83 84 while ( have_posts() ) : 85 the_post(); 86 ?> 87 <item> 88 <title><?php the_title_rss(); ?></title> 89 <link><?php the_permalink_rss(); ?></link> 90 <?php if ( get_comments_number() || comments_open() ) : ?> 91 <comments><?php comments_link_feed(); ?></comments> 92 <?php endif; ?> 93 94 <dc:creator><![CDATA[<?php the_author(); ?>]]></dc:creator> 95 <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> 96 <?php the_category_rss( 'rss2' ); ?> 97 <guid isPermaLink="false"><?php the_guid(); ?></guid> 98 99 <?php if ( get_option( 'rss_use_excerpt' ) ) : ?> 100 <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> 101 <?php else : ?> 102 <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> 103 <?php $content = get_the_content_feed( 'rss2' ); ?> 104 <?php if ( strlen( $content ) > 0 ) : ?> 105 <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded> 106 <?php else : ?> 107 <content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded> 108 <?php endif; ?> 109 <?php endif; ?> 110 111 <?php if ( get_comments_number() || comments_open() ) : ?> 112 <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link( null, 'rss2' ) ); ?></wfw:commentRss> 113 <slash:comments><?php echo get_comments_number(); ?></slash:comments> 114 <?php endif; ?> 115 116 <?php rss_enclosure(); ?> 117 118 <?php 119 /** 120 * Fires at the end of each RSS2 feed item. 121 * 122 * @since 2.0.0 123 */ 124 do_action( 'rss2_item' ); 125 ?> 126 </item> 127 <?php endwhile; ?> 128 </channel> 129 </rss>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Fri Sep 11 08:20:31 2026 | Cross-referenced by PHPXref |