Created
November 6, 2025 10:43
-
-
Save rvdsteege/7223f7455f5e8e5944ecc082360c43a7 to your computer and use it in GitHub Desktop.
Retrieving Visma EasyCruit vacancy details in templates with the https://www.pronamic.shop/product/pronamic-visma-easycruit/ plugin.
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 | |
| $post_id = get_the_ID(); | |
| $vacancy_xml = \get_post_meta( $post_id, '_easycruit_vacancy_xml', true ); | |
| $vacancy = Vacancy::from_xml( $vacancy_xml ); | |
| // Vacancy version. | |
| $version_language = \get_option( 'easycruit_vacancy_version_language' ); | |
| $vacancy_version = $vacancy->get_version( $version_language ); | |
| $candidate_profile = $vacancy_version->candidate_profile; | |
| $job_offer = $vacancy_version->job_offer; | |
| // Departments. | |
| $xml = \simplexml_load_string( $vacancy_xml ); | |
| $departments = $xml->Departments->Department; | |
| $departments = is_array( $departments ) ? $departments : [ $departments ]; | |
| $index = 0; | |
| foreach ( $vacancy->get_departments() as $department ) { | |
| $addresses = [ | |
| $department->get_postal_address(), | |
| $department->get_office_address(), | |
| ]; | |
| foreach ( $addresses as $address ) { | |
| $street = $address->get_street(); | |
| $area_code = $address->get_area_code(); | |
| $area = $address->get_area(); | |
| } | |
| foreach ( $departments[ $index ]->ContactPersons->ContactPerson as $contact_person ) { | |
| $contact_person_name = $contact_person->CommonName; | |
| $contact_person_telephone = $contact_person->Telephone; | |
| } | |
| $image_url = $xml->Departments->Department[ $index ]->ImageURL; | |
| $vacancy_url = $xml->Departments->Department[ $index ]->VacancyURL; | |
| $email_to_friend_url = $xml->Departments->Department[ $index ]->EmailToFriendURL; | |
| $index++; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment