Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matadorjobs/82bdb145a6a549777c294ee50d67d248 to your computer and use it in GitHub Desktop.
Save matadorjobs/82bdb145a6a549777c294ee50d67d248 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