Careers at The Only Facial

// Shortcode: [paylocity_jobs departments=”Sales,Marketing” locations=”St. Louis,Remote”]
function collina_paylocity_jobs_shortcode( $atts ) {
$atts = shortcode_atts(
array(
‘departments’ => ”,
‘locations’ => ”,
),
$atts,
‘paylocity_jobs’
);

// Your Paylocity GUID
$guid = ‘f3f28b00-201d-4fba-a7dd-532a9e558191’;

// Build query string for optional filters
$query_args = array();

if ( ! empty( $atts[‘departments’] ) ) {
$departments = array_map( ‘trim’, explode( ‘,’, $atts[‘departments’] ) );
foreach ( $departments as $dep ) {
$query_args[‘departments’][] = $dep;
}
}

if ( ! empty( $atts[‘locations’] ) ) {
$locations = array_map( ‘trim’, explode( ‘,’, $atts[‘locations’] ) );
foreach ( $locations as $loc ) {
$query_args[‘locations’][] = $loc;
}
}

$base_url = “https://recruiting.paylocity.com/recruiting/v2/api/feed/jobs/$guid”;
$url = add_query_arg( $query_args, $base_url );

// Call Paylocity
$response = wp_remote_get( $url, array( ‘timeout’ => 10 ) );

if ( is_wp_error( $response ) ) {
return ‘

Sorry, we’re unable to load job openings right now.

‘;
}

$body = wp_remote_retrieve_body( $response );
$data = json_decode( $body, true );

if ( ! $data || empty( $data[‘jobs’] ) ) {
return ‘

No current openings. Please check back soon.

‘;
}

ob_start();
?>




·



·