Page 1 of 3 123 LastLast
Results 1 to 10 of 25
Like Tree1Likes

Thread: Create an XML Feed to Feature Your Jobs on Indeed

  1. #1
    Thread Starter
    Senior Member bbuster79's Avatar
    Join Date
    Jan 2011
    Location
    United States
    Posts
    106
    Thanks
    5
    Thanked 10 Times in 7 Posts

    Create an XML Feed to Feature Your Jobs on Indeed

    Indeed requires several fields that aren't included in the default RSS feed JR comes equipped with. I've created an Indeed compliant XML feed that includes these fields, including Company, City and State.

    Just swap out the URL's for your own and cut and paste this into a page template. You'll have a custom XML feed. If you wish, this could also be easily modified to an RSS feed by just changing a few lines of code.

    <?php
    //Template Name: Indeed XML Generator
    header('Content-Type: text/xml');
    $doc = new DOMDocument('1.0','utf-8');
    $doc->formatOutput = true;

    //root element
    $r = $doc->createElement( "source" );
    //append root element to our document
    $doc->appendChild( $r );

    $publisher = $doc->createElement("publisher");
    $publisher->appendChild($doc->createTextNode("ExampleURL.com"));
    $r->appendChild($publisher);

    $publisherurl = $doc->createElement("publisherurl");
    $publisherurl->appendChild($doc->createTextNode("http://ExampleURL.com"));
    $r->appendChild($publisherurl);

    $job = array();
    //set args for query
    $args = array(
    'post_type' => 'job_listing',
    'posts_per_page' => -1,
    'post_status' => 'publish',
    'orderby' => 'date',
    'order' => 'DESC'
    );
    //run query
    $feed_jobs = new WP_Query($args);


    while($feed_jobs->have_posts()) : $feed_jobs->the_post();

    $b = $doc->createElement( "job" );

    $title = $doc->createElement("title");
    $title->appendChild($doc->createCDATASection( $post->post_title));
    $b->appendChild( $title );

    $company_name = get_post_meta($post->ID,'_Company',true);
    $company = $doc->createElement("company");
    $company->appendChild($doc->createCDATASection($company_name));
    $b->appendChild($company);

    $date = $doc->createElement("date");
    $date->appendChild($doc->createCDATASection($post->post_date));
    $b->appendChild($date);

    $referencenumber = $doc->createElement("referencenumber");
    $referencenumber->appendChild($doc->createCDATASection($post->ID));
    $b->appendChild($referencenumber);

    $url = $doc->createElement("url");
    $url->appendChild($doc->createCDATASection($post->guid));
    $b->appendChild($url);

    $description = $doc->createElement("description");
    $description->appendChild($doc->createCDATASection($post->post_content));
    $b->appendChild($description);

    //query postmeta table for city and state// then parse it into an array
    $location = get_post_meta($post->ID,'geo_address',true);
    $location = explode(',',$location);

    $city = $doc->createElement("city");
    $city->appendChild($doc->createCDATASection($location[0]));
    $b->appendChild($city);

    $state = $doc->createElement("state");
    $state->appendChild($doc->createCDATASection($location[1]));
    $b->appendChild($state);

    $country = $doc->createElement("country");
    $country->appendChild($doc->createCDATASection("US"));
    $b->appendChild($country);


    $r->appendChild( $b );

    endwhile;

    echo $doc->saveXML();

  2. The Following 4 Users Say Thank You to bbuster79 For This Useful Post:

    coza (March 9th, 2012), gregpill (March 6th, 2012), hamza (February 25th, 2012), magicyoyo (November 10th, 2011)

  3. #2
    Veteran barukar's Avatar
    Join Date
    Sep 2010
    Location
    Brasil, São Paulo, SP
    Posts
    6,785
    Thanks
    186
    Thanked 742 Times in 623 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    -------------------------------------------------------------------------------------------
    Projects: ClassiNoiva - Classimóveis - vocênoenem - i50 - Clube DETRAN

  4. #3
    Senior Member johnjohnjohn's Avatar
    Join Date
    May 2011
    Location
    Mexico
    Posts
    133
    Thanks
    12
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,978
    Thanks
    170
    Thanked 3,407 Times in 3,278 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  6. #5
    Senior Member johnjohnjohn's Avatar
    Join Date
    May 2011
    Location
    Mexico
    Posts
    133
    Thanks
    12
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. #6
    Junior Member gregpill's Avatar
    Join Date
    Jan 2011
    Location
    Joburg, South Africa
    Posts
    34
    Thanks
    7
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Last edited by gregpill; March 6th, 2012 at 04:33 PM. Reason: typos

  8. #7
    jobortunity's Avatar
    Join Date
    Oct 2011
    Location
    Kitchener, Ontario
    Posts
    153
    Thanks
    11
    Thanked 11 Times in 9 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #8
    Junior Member gigajobs's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    31
    Thanks
    0
    Thanked 4 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. #9
    Junior Member gregpill's Avatar
    Join Date
    Jan 2011
    Location
    Joburg, South Africa
    Posts
    34
    Thanks
    7
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  11. #10
    Senior Member johnjohnjohn's Avatar
    Join Date
    May 2011
    Location
    Mexico
    Posts
    133
    Thanks
    12
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 1.5.1 how to move indeed feed to below jobs?
    By santakrooz in forum Help Using JobRoller
    Replies: 17
    Last Post: September 6th, 2012, 08:07 PM
  2. Indeed Feed not Pulling Jobs
    By jigsawmark in forum Report JobRoller Bugs
    Replies: 4
    Last Post: September 4th, 2011, 10:46 PM
  3. Create new rss feed for jobs?
    By nicknolting in forum Report JobRoller Bugs
    Replies: 1
    Last Post: January 14th, 2011, 04:44 AM