Making WordPress.org

Ticket #5750: 5750-untagged-posts.txt

File 5750-untagged-posts.txt, 3.2 KB (added by RMarks, 4 years ago)

A rough idea of a patch

Line 
1Add to wordpress.org/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/functions.php:
2****************************************************
3add_action( 'init', 'untagged_RSS' );
4function untagged_RSS(){
5        add_feed( 'untagged', 'untagged_RSS_feed' );
6}
7
8function untagged_RSS_feed() {
9        get_template_part( 'rss', 'untagged' );
10}
11****************************************************
12
13
14Create wordpress.org/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/rss-untagged.php
15****************************************************
16<?php
17/**
18 * Template Name: Custom RSS Template - Untagged Posts
19 */
20$tags = get_terms('post_tag', array( 'fields'=>'ids' ) );
21$args = array(
22  'post_type' => 'post',`
23  'tax_query' => array(
24    array(
25      'taxonomy' => 'post_tag',
26      'field' => 'id',
27      'terms' => $tags,
28      'operator' => 'NOT IN'
29    )
30  )
31);
32$query = new WP_Query( $args );
33header( 'Content-Type: '.feed_content_type( 'rss-http' ).'; charset='.get_option( 'blog_charset' ), true);
34echo '<?xml version="1.0" encoding="'.get_option( 'blog_charset' ).'"?'.'>';
35?>
36<rss version="2.0"
37        xmlns:content="http://purl.org/rss/1.0/modules/content/"
38        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
39        xmlns:dc="http://purl.org/dc/elements/1.1/"
40        xmlns:atom="http://www.w3.org/2005/Atom"
41        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
42        xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
43        <?php do_action( 'rss2_ns' ); ?>>
44<channel>
45        <title><?php bloginfo_rss( 'name' ); ?> - Feed</title>
46        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
47        <link><?php bloginfo_rss( 'url' ) ?></link>
48        <description><?php bloginfo_rss( 'description' ) ?></description>
49        <lastBuildDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false); ?></lastBuildDate>
50        <language><?php echo get_option( 'rss_language' ); ?></language>
51        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
52        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
53        <?php do_action( 'rss2_head' ); ?>
54        <?php while($query->have_posts()) : $query->the_post(); ?>
55                <item>
56                        <title><?php the_title_rss(); ?></title>
57                        <link><?php the_permalink_rss(); ?></link>
58                        <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true), false); ?></pubDate>
59                        <dc:creator><?php the_author(); ?></dc:creator>
60                        <guid isPermaLink="false"><?php the_guid(); ?></guid>
61                        <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
62                        <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
63                        <?php rss_enclosure(); ?>
64                        <?php do_action( 'rss2_item' ); ?>
65                </item>
66        <?php endwhile; ?>
67</channel>
68</rss>
69****************************************************