Custom Wordpress XML Feed help

I need some help with a custom XML feed i need to work.

I need the feed below to only pull jobs which are tagged "careerbuilder". and then only show 120 of those posts.

At the moment, I have zero posts tagged with "careerbuilder" but it's still pulling 120 other posts.  How can i fix the code below, so that only posts tagged careerbuiler show up?.   the xml feed is found here

<?php
/**
 * Template Name: Custom CareerBuilder RSS Template - cretefeed
 */
 
$postCount = 120; // The number of posts to show in the feed
$posts = query_posts('showposts=' . $postCount, 'tag=careerbuilder');
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'); ?> - Feed</title>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php get_permalink(); ?></link>
        <description><?php bloginfo_rss('description') ?></description>
        <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></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(); ?>
                
                <job>
					<title><?php the_title_rss(); ?></title>
					<date><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></date>
					<referencenumber><?php the_id(); ?></referencenumber>
					<url><?php the_permalink_rss(); ?>&#63;utm_source=Crete_CareerBuilderJobPost</url>
					<company><![CDATA[Crete Carrier]]></company>
					<city><![CDATA[<?php the_field('city'); ?>]]></city>
					<state><![CDATA[<?php the_field('state'); ?>]]></state>
					<country><![CDATA[US]]></country>
					
<?php if (get_option('rss_use_excerpt')) : ?>
							<description><![CDATA[<?php the_excerpt() ?>]]></description>
							<applylink><?php echo ('https://intelliapp2.driverapponline.com/c/cretecarrier_Crete_CareerBuilderJobPost'); ?></applylink>
							<?php else : ?>
								<description><![CDATA[<?php the_excerpt() ?>]]></description>
								<applylink><?php echo ('https://intelliapp2.driverapponline.com/c/cretecarrier_Crete_CareerBuilderJobPost'); ?></applylink>
							<?php if ( strlen( $post->post_content ) > 0 ) : ?>
								<content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
							<?php else : ?>
								<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
							<?php endif; ?>
						<?php endif; ?>
					<salary><?php echo do_shortcode( get_post_meta( get_the_id(), 'salary', true ) ); ?></salary>
					<experience><?php echo do_shortcode( '[Qualifications]' ); ?></experience>
					<jobtype><![CDATA[<?php the_field('jobtype'); ?>]]></jobtype>
					<category><?php the_category( ' ' ); ?></category>
					<tags><?php the_tags( ' ' ); ?></tags>
					<?php rss_enclosure(); ?>
					<?php do_action('rss2_item'); ?>
				</job>
        <?php endwhile; ?>
</channel>
</rss>

Open in new window

Jon ImmsWeb DeveloperAsked:
Who is Participating?
 
hieloCommented:
Try passing a single url string  (note that the comma changed to dot to concatenate the two strings AND an ampersand appears to the left of tag):
$posts = query_posts('showposts=' . $postCount . '&tag=careerbuilder');

OR pass an associative array:
$posts = query_posts('showposts' => $postCount, 'tag' => 'careerbuilder');
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.