Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active January 16, 2021 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/595c32a0ebdfc7b0106984afc8712afe to your computer and use it in GitHub Desktop.
Save tripflex/595c32a0ebdfc7b0106984afc8712afe to your computer and use it in GitHub Desktop.
Output og:image tag for Job Listing from custom field file/upload type when using WP Job Manager Field Editor
<?php
add_action( 'wp_head', 'smyles_output_job_listing_og_image' );
function smyles_output_job_listing_og_image() {
if ( is_singular( 'job_listing' ) ) {
$some_meta_key = get_job_field( 'some_meta_key', get_the_ID(), array( 'output_as' => 'value' ) );
if ( ! empty( $some_meta_key ) ) {
echo '<meta property="og:image" content="' . $some_meta_key . '" />';
}
}
}
@tripflex
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment