Since the plugin you are using does not provide the data you need until the loop_end
hook, getting information into the header is going to be tricky. I can only think of two ways to proceed:
- Use Javascript to insert the data into the header after page load. I
don’t know if this will work. I am not sure if the “og” headers will
be respected. - Run a loop before the page loads, and get your data early. I have no
to test that but I imagine it too look something like this:
function generateOGtag(){
if (is_single()) {
global $wp_query;
if (have_posts()) {
while (have_posts()) {
the_post();
// no idea if your plugin needs anything else here
}
}
$jobTitle = get_jobs()->get("job_title");
$jobDescription = get_jobs()->get("job_description");
echo "<meta property='og:title' content="$jobTitle">\n";
echo "<meta property='og:title' content="$jobDescription">\n";
wp_reset_query();
wp_reset_postdata();
}
}
add_action("wp_head", 'generateOGtag');
This is obviously a labor intensive procedure as code will run twice.