Foreco
April 3, 2025, 9:36am
1
Hello,
My SEO Schema JobOffer is not working correctly. It is missing the attibutes below.
Where the title should be the listing title. and Location should be build as followed:
"jobLocation": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"streetAddress": "1600 Amphitheatre Pkwy",
"addressLocality": "Mountain View",
"addressRegion": "CA",
"postalCode": "94043",
"addressCountry": "US"
}
},
These items are missing (Each listing can have a different JobLocation) and hiringOrganization).
ihor
April 4, 2025, 7:30pm
4
Please try using this code snippet to add the missing properties:
add_filter(
'hivepress/v1/models/listing/schema',
function( $schema ) {
$listing = hivepress()->request->get_context( 'listing' );
if ( ! $listing ) {
return $schema;
}
$schema['title'] = $listing->get_title();
$schema['jobLocation'] = $listing->get_location();
$schema['datePosted'] = $listing->get_created_date();
$image = $listing->get_vendor__image();
if ( $image ) {
$image = $image->get_url( 'thumbnail' );
}
$schema['hiringOrganization'] = [
'name' => $listing->get_vendor__name(),
'logo' => $image,
];
return $schema;
}
);
Foreco
April 7, 2025, 6:30am
5
Works like a charm! Thank you.
Is it possible to upgrade the code a bit? I want the adress line of the jobLocation as following. For this i add attributes to the vendor (all text fields) See screenshot below:
Where i want to map the following structure:
Foreco:
"jobLocation": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"streetAddress": "Vendor > {$straat}",
"addressLocality": "Vendor > {$plaatsnaam}",
"postalCode": "Vendor > {$postadres)",
"addressCountry": "NL"
}
},
Please can you help me upgrading the code to this markup?
ihor
April 7, 2025, 8:04pm
7
It’s possible to add extra details (e.g. based on the existing listing attributes), but unfortunately there’s no way to break the location text into address parts, since there’s no specific structure. A possible workaround is breaking it by comma but this may not be reliable.
Foreco
April 8, 2025, 6:19am
8
Hello, this is why i made the extra attributes at the Vendor so you don’t need to break down the addres.
Can you please tell me how to get the value of the extra attributes? We prefer to use the vendor attributes as i told in the first reaction.
So: (Ventor attribute) (postadres) should be:
"jobLocation": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"streetAddress": "Vendor > {$straat}",
"addressLocality": "Vendor > {$plaatsnaam}",
"postalCode": "***{$postadres)***",
"addressCountry": "NL"
}
},
Do you understand my question?
It should be something like this i assume:
$schema['jobLocation'] = [
'@type' => 'Place',
'address' => [
'@type' => 'PostalAddress',
'streetAddress' => 'Vendor > ' . $listing->get_vendor__address(),
'addressLocality' => 'Vendor > ' . $listing->get_vendor__city(),
'postalCode' => 'Vendor > ' . $listing->get_vendor__postcode(),
'addressCountry' => 'NL'
]
];
Foreco
April 9, 2025, 6:27am
10
Hello,
I tried some stuff and got it solved, thank you for your support!
$schema['jobLocation'] = [
'@type' => 'Place',
'address' => [
'@type' => 'PostalAddress',
'streetAddress' => $listing->get_vendor__straat(),
'addressLocality' => $listing->get_vendor__plaatsnaam(),
'postalCode' => $listing->get_vendor__postadres(),
'addressCountry' => 'NL'
]
];
1 Like
ihor
April 9, 2025, 8:59pm
11
Thanks for sharing the solution!
Yes, if you have these details as separate attributes, you can get any attribute via the $listing->get_attributenamehere() code.
system
Closed
May 9, 2025, 8:59pm
12
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.