Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created February 27, 2018 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/a078d7df291e97d8db9f21873c6a1774 to your computer and use it in GitHub Desktop.
Save tripflex/a078d7df291e97d8db9f21873c6a1774 to your computer and use it in GitHub Desktop.
Only send email template for featured listings with WP Job Manager Emails (requires 2.4.0+)
<?php
add_filter( 'job_manager_emails_email_should_send', 'smyles_only_send_for_featured_listings', 10, 4 );
// You MUST configure the "template name" under the advanced settings area, and set it to "job_expired_featured_only", or
// if you want to use something custom, update the code below to match what you used
function smyles_only_send_for_featured_listings( $should_send, $template, $listing_id, $that ) {
if( $template && $template->template_name && $template->template_name === 'job_expired_featured_only' ){
$is_featured = get_post_meta( $listing_id, '_featured', true );
if( ! $is_featured ){
return false;
}
}
return $should_send;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment