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

 * 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"
        <?php do_action('rss2_ns'); ?>>
        <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(); ?>
					<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>
<?php if (get_option('rss_use_excerpt')) : ?>
							<description><![CDATA[<?php the_excerpt() ?>]]></description>
							<applylink><?php echo (''); ?></applylink>
							<?php else : ?>
								<description><![CDATA[<?php the_excerpt() ?>]]></description>
								<applylink><?php echo (''); ?></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'); ?>
        <?php endwhile; ?>

Open in new window

Jon ImmsWeb DeveloperAsked:
Who is Participating?
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');
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.