Creating a Custom XML Feed
-
I’m probably making this harder on myself than it has to be. If there is a built in WP function or plugin that can generate a custom feed please let me know.
I’m trying to create a feed for a wp powered job board to send to Indeed.com. It should send them all the currently active jobs I have on my site.
Here is what I have so far…
$args = array( 'post_type' => 'job_listing', 'post_status' => 'publish', 'showposts' => -1 ); $feed = query_posts($args); echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <source> <publisher>example.com</publisher> <publisherurl>http://www.example.com</publisherurl> <lastBuildDate><?php date(); ?></lastBuildDate> <?php while($feed->have_posts()) : $feed->the_post(); ?> <job> <title><![CDATA[<?php $feed->the_title(); ?>]]></title> <date><![CDATA[<?php $feed->post_date(); ?>]]></date> <referencenumber><![CDATA[<?php $feed->ID; ?>]]></referencenumber> <url><![CDATA[<?php the_permalink(); ?>]]></url> <company><![CDATA[<?php get_post_meta($feed->ID,'_Company'); ?>]]></company> <city><![CDATA[<?php get_post_meta($feed->ID,'geo_short_address'); ?>]]></city> <description><![CDATA[<?php $feed->the_content(); ?>]]></description> </job> <?php endwhile; ?> </source>I’ve plugged this into a page template and assigned it to a blank page, similar to a method outline on the Yoast website.
Though all I’m getting is a blank page.
The topic ‘Creating a Custom XML Feed’ is closed to new replies.