On Wordpress Custom RSS template array custom tags taxonomy display only the first

60 Views Asked by At

I use the Wordpress bimber theme and i try to make a custom RSS Template. With custom type of tags taxonomy, called reaction. I wanna for results to display in rss random posts attached only following reactions but my code gives me only the first reaction of the list on rss url all the time.
This is my code:

<?php
/**
 * Template Name: TEST REACTIONS RSS
 */

$posts = query_posts( array( 
    'reaction' => array( 'oreo', 'omg', 'win', 'wtf', 'eleos', 'klama', 'eksypno', 'lol', 'teleio' ),
    'showposts' => 1,
    'orderby' => 'rand'
    ) );
//$postCount = 3; // The number of posts to show in the feed
//$posts = query_posts( 'cat=187&orderby=date&reaction=lol&showposts=' . $postCount);

header('Content-Type: '.feed_content_type('rss-http').'; charset='.get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
?>
<rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
        <?php do_action('rss2_ns'); ?>>
<channel>
        <title><?php bloginfo_rss('name'); ?></title>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php bloginfo_rss('url') ?></link>
        <description><?php bloginfo_rss('description') ?></description>
        <lastBuildDate><?php $timezone  = +3; echo gmdate("D, d M Y H:i:s", time() + 3600*($timezone+date("I"))); ?> +0000</lastBuildDate>
        <language><?php echo get_option('rss_language'); ?></language>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
        <?php do_action('rss2_head'); ?>
        <?php while(have_posts()) : the_post(); ?>
                <item>
                    <title><p><?php the_title_rss(); ?></p>
                            <?php /** $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo '#'.$tag->name . ' '; } } **/ ?></title>
                    
                        <link><?php the_permalink_rss(); ?></link>
                        <pubDate><?php $timezoner  = +3; echo gmdate("D, d M Y H:i:s", time() + 3600*($timezoner+date("I"))); ?> +0000</pubDate>
                        <dc:creator><?php the_author(); ?></dc:creator>
                        <guid isPermaLink="false"><?php the_guid(); ?></guid>
                        <description><![CDATA[<?php /** the_excerpt_rss(); **/ ?>]]></description>
                        <content:encoded><p><?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo '#' . str_replace(' ', '', $tag->name) . ' '; } } ?></p></content:encoded>
                        <?php do_action('rss2_item'); ?>
                </item>
        <?php endwhile; ?>
</channel>
</rss>

Can anyone help me? Thank you

0

There are 0 best solutions below