1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
function offshore_career_locations( $id ) {
$states = get_the_terms( $id, 'state' );
$countries = get_the_terms( $id, 'country' );
$states_arr = array();
$countries_arr = array();
$output = '';
if ( $states && $countries && ! is_wp_error( $states ) && ! is_wp_error( $countries ) ) {
foreach ( $states as $term ) {
$states_arr[] = ucfirst( $term->name );
}
foreach ( $countries as $term ) {
$countries_arr[] = ucfirst( $term->name );
}
$locations = array_combine( $states_arr, $countries_arr );
if( $locations ){
$output .= '<div class="location">';
$i = 1; $count = count( $locations );
foreach ( $locations as $state => $country ) {
$output .= '<p class="state">' . esc_html( $state ) . '</p>';
$output .= '<p class="country">' . esc_html( $country ) . '</p>';
}
$output .= '</div>';
}
}
return $output;
}
function offshore_work_type( $id, $type ) {
$terms = get_the_terms( $id, $type );
$output = '';
if ( $terms && ! is_wp_error( $terms ) ) {
foreach ( $terms as $term ) {
$output .= '<span class="designation-type">' . strtoupper( esc_html( $term->name ) ) . '</span>';
}
}
return $output;
}