Matador Jobs Pro – Jobs Syndication Feeds Add-on includes a variety of standardized XML feeds for easy integration with major job boards right out of the box. However, there might be instances where you need to create your own custom feed to meet specific requirements. This guide is designed to walk you through the process of making such modifications.
If you’re looking for a guide on overriding one of the default feeds, see here.
To create a custom feed, we need to register the feed so it is picked up by the rest of the add-on’s code, and provide a template that can be used to render the feed.
Below we’ll be adding a custom feed for a (fictional) job board called ‘Talent Terrace’. Substitute out references to this job board as needed for your use-case
1. Register the feed
To register the feed, we simply need to add it to the list of registered feeds using the matador_extension_feeds_registered_feeds’ filter.
Here is an example registering out ‘Talent Terrace’ Feed:
/**
* Adding 'Talent Terrace' Feed
*/
add_filter( 'matador_extension_feeds_registered_feeds', static function ( $feeds ) {
$feeds['talent-terrace'] = [ // feed ID needs to match the template name
'name' => 'Talent Terrace', // friendly feed label
'description' => __( 'Example custom feed.', 'matador-child' ), // feed description
'info_link' => 'https://domain.com/', // optional link to more info about the feed
'docs_link' => 'https://domain.com/docs', // optional link to doc about the feed
];
return $feeds;
} );
2. Add Custom Feed Files
The custom feed will need a template to render the necessary XML for the feed. You need to create this file in your theme, or child-theme mimicking the file structure within the add on as follows:
<your-theme>/matador/feeds/<your-custom-feed>.php
So for the ‘Talent Terrace’ feed being added to a child theme called ‘matador-child’ the file path would be:
matador-child/matador/feeds/talent-terrace.php
For an example of a child theme containing a custom feed, see here.
Once you have created your feeds files, you will need to render xml in them according to the specifications required for your use-case.
3. Test your feed
Once you’ve added some code to your custom feed files you’ll want to give them a test!
To do this go to the Syndication tab in Matador’s settings, scroll down until you see the toggle switch for your custom feed, and ensure it’s toggled to on. Save the settings, then go to your site’s Settings > Permalinks, and save click ‘save changes’ to refresh the permalinks on your site.
Next you need to navigate to your custom feeds URL. This URL will be made up of 3 parts:
- Site Domain – your site’s domain
- Job Listings Slug – the job listings slug, by default this will be ‘jobs’
- Feed Name – the name of your feed, as filled in when you registered the feed in step 1.
So, for our Talent Terrace example, on a site called example.com where the jobs listings slug is the default ‘jobs’, our custom feed’s URL is:
example.com/jobs/talent-terrace
Once you’ve visited your feed and checked it is rendering as desired, you’re all done!