Forked from matadorjobs/matador_jobs_add_logo_to_job_structured_data.php
Created
May 26, 2021 02:01
-
-
Save blueprintmrk/7f72abfbab34229b70bfa7c68c731aae to your computer and use it in GitHub Desktop.
Matador Jobs add a company/site logo to Job JSON+LD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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