Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created September 28, 2017 14:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/db6beb09ce2918d82c58c15b91dec723 to your computer and use it in GitHub Desktop.
Save tripflex/db6beb09ce2918d82c58c15b91dec723 to your computer and use it in GitHub Desktop.
Add Job Categories to Job Alerts email template (https://wpjobmanager.com/document/overriding-add-template-files/)
<?php
global $post;
$type = get_the_job_type();
$location = get_the_job_location();
$company = get_the_company_name();
// The arguments after 'job_listing_category' is "before" then "separator" then "after"
$job_categories = get_the_term_list( $post->ID, 'job_listing_category', '', ', ', '' );
echo "\n";
// Job type
if ( $type ) {
echo esc_html( $type->name ) . ' - ';
}
// Job title
echo esc_html( $post->post_title ) . "\n";
// Location and company
if ( $location ) {
printf( __( 'Location: %s', 'wp-job-manager-alerts' ) . "\n", esc_html( strip_tags( $location ) ) );
}
if ( $company ) {
printf( __( 'Company: %s', 'wp-job-manager-alerts' ) . "\n", esc_html( strip_tags( $company ) ) );
}
if( $job_categories ){
printf( __( 'Categories: %s', 'wp-job-manager-alerts' ) . "\n", esc_html( strip_tags( $job_categories ) ) );
}
// Permalink
printf( __( 'View Details: %s', 'wp-job-manager-alerts' ) . "\n", get_the_job_permalink() );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment