Last active
January 16, 2021 01:57
-
-
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
This file contains 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_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 . '" />'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
resumes:
https://gist.github.com/tripflex/f68eea367a93ff14220db1e55f2cce40