Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blueprintmrk/7f72abfbab34229b70bfa7c68c731aae to your computer and use it in GitHub Desktop.
Save blueprintmrk/7f72abfbab34229b70bfa7c68c731aae to your computer and use it in GitHub Desktop.
Matador Jobs add a company/site logo to Job JSON+LD
<?php
/**
* Add Logo to Job Structured Data (JSON+LD)
*
* @see https://matadorjobs.com/support/documentation/add-a-logo-to-google-for-jobs-listings/
*
* @param array $ld the Job Structured Data before save.
* @return array $ld the modified Job Structured Data for saving.
*/
function mj_add_logo_to_job_jsonld( $ld ) {
// Use any image file larger than 114px x 114px.
// Consider using the site icon function.
$icon = 'https://yoursite.com/path/to/default-icon.png';
if ( has_site_icon() ) {
$icon = get_site_icon_url();
}
if ( $icon ) {
$ld['hiringOrganization']['logo'] = $icon;
}
return $ld;
}
add_action( 'matador_bullhorn_import_save_job_jsonld', 'mj_add_logo_to_job_jsonld' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment