Created
February 27, 2018 23:56
-
-
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+)
This file contains 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 | |
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