Created
December 11, 2017 18:41
-
-
Save tripflex/119550a07baf0dec883e3d8c95c03400 to your computer and use it in GitHub Desktop.
Add Featured shortcode to WP Job Manager Emails (version 2.1.0 or older, 2.1.1+ has this included already)
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 | |
// REPLACE THE FUNCTION init_shortcodes() in the file located at: | |
// wp-content/plugins/wp-job-manager-emails/includes/shortcodes/class-job.php | |
// STARTING ON LINE #39, WITH THE UPDATED FUNCTION CODE BELOW: | |
// YOU WILL NOTICE THE ONLY THING THAT IS DIFFERENT IS THE ADDITION OF THE "featured" SHORTCODE | |
// DO NOT COPY ANYTHING ABOVE THIS LINE, ONLY THE CODE BELOW: | |
function init_shortcodes(){ | |
$singular = $this->cpt()->get_singular(); | |
$shortcodes = apply_filters( 'job_manager_emails_job_shortcodes', | |
array( | |
'job_id' => array( | |
'label' => sprintf( __( '%s ID' ), $singular ), | |
'description' => sprintf( __( '%s ID' ), $singular ), | |
'meta_key' => 'application', | |
'nonmeta' => true | |
), | |
'job_raw_email' => array( | |
'label' => sprintf( __( '%s Application Email' ), $singular ), | |
'description' => sprintf( __( '%s Application Email (if set), same as [application]' ), $singular ), | |
'meta_key' => 'application', | |
'nonmeta' => true | |
), | |
'job_dashboard_url' => array( | |
'label' => sprintf( __( '%s Dashboard URL' ), $singular ), | |
'description' => sprintf( __( 'URL to the %s Dashboard' ), $singular ), | |
'nonmeta' => TRUE | |
), | |
'job_title' => array( | |
'label' => sprintf( __( '%s Title' ), $singular ), | |
'description' => sprintf( __( '%s Title' ), $singular ), | |
'meta_key' => 'post_title', | |
'post_title' => TRUE | |
), | |
'job_description' => array( | |
'label' => sprintf( __( '%s Description' ), $singular ), | |
'description' => sprintf( __( '%s Description' ), $singular ), | |
'meta_key' => 'post_content', | |
'post_content' => TRUE, | |
'nonmeta' => FALSE, | |
'required' => TRUE | |
), | |
'view_job_url' => array( | |
'label' => sprintf( __( '%s URL' ), $singular ), | |
'description' => sprintf( __( '%s Frontend Listing URL' ), $singular ), | |
'nonmeta' => TRUE | |
), | |
'view_job_url_admin' => array( | |
'label' => sprintf( __( '%s Admin URL' ), $singular ), | |
'description' => sprintf( __( '%s Admin Area Edit/View URL' ), $singular ), | |
'nonmeta' => TRUE | |
), | |
'job_fields' => array( | |
'label' => sprintf( __( 'All %s Fields' ), $singular ), | |
'description' => sprintf( __( 'Will output all %s in list format' ), $singular ), | |
'callback' => 'output_all_fields', | |
'nonmeta' => TRUE, | |
'args' => array( | |
'skip_keys' => array( | |
'desc' => __( 'The meta keys to skip when outputting all fields' ), | |
'value' => __( 'Any meta key(s) (comma separated)' ), | |
'required' => FALSE, | |
'example' => 'job_description,job_title' | |
) | |
) | |
), | |
'job_author_email' => array( | |
'label' => sprintf( __( '%s Author Email' ), $singular ), | |
'description' => __( 'Email address of the author who submitted the listing' ), | |
'callback' => 'job_author_email', | |
'nonmeta' => true | |
), | |
'job_author_name' => array( | |
'label' => sprintf( __( '%s Author Name' ), $singular ), | |
'description' => __( 'First and last name of the author who submitted the listing' ), | |
'callback' => 'job_author_name', | |
'nonmeta' => true | |
), | |
'job_expires' => array( | |
'label' => sprintf( __( '%s Expires Date' ), $singular ), | |
'description' => __( 'Will output the expiration date' ), | |
'nonmeta' => TRUE, | |
'callback' => 'job_expires' | |
), | |
'featured' => array( | |
'label' => sprintf( __( '%s Featured' ), $singular ), | |
'description' => __( 'Whether or not a listing is a featured listing' ), | |
) | |
) | |
); | |
$this->shortcodes = $shortcodes; | |
return $shortcodes; | |
} |
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 | |
// REPLACE THE FUNCTION init_shortcodes() in the file located at: | |
// wp-content/plugins/wp-job-manager-emails/includes/shortcodes/class-resume.php | |
// STARTING ON LINE #35, WITH THE UPDATED FUNCTION CODE BELOW: | |
// YOU WILL NOTICE THE ONLY THING THAT IS DIFFERENT IS THE ADDITION OF THE "featured" SHORTCODE | |
// DO NOT COPY ANYTHING ABOVE THIS LINE, ONLY THE CODE BELOW: | |
function init_shortcodes(){ | |
$singular = $this->cpt()->get_singular(); | |
$shortcodes = apply_filters( 'job_manager_emails_resume_shortcodes', | |
array( | |
'resume_id' => array( | |
'label' => __( 'Resume ID', 'wp-job-manager-emails' ), | |
'nonmeta' => TRUE | |
), | |
'application_message' => array( | |
'label' => __( 'User Application Message', 'wp-job-manager-emails' ), | |
'nonmeta' => TRUE | |
), | |
'candidate_name' => array( | |
'label' => sprintf( __( '%s Candidate Name', 'wp-job-manager-emails' ), $singular ), | |
'description' => sprintf( __( '%s Candidate Name', 'wp-job-manager-emails' ), $singular ), | |
'meta_key' => 'post_title', | |
'post_title' => TRUE, | |
'required' => TRUE | |
), | |
'resume_content' => array( | |
'label' => sprintf( __( '%s Content', 'wp-job-manager-emails' ), $singular ), | |
'description' => sprintf( __( 'Main %s Content', 'wp-job-manager-emails' ), $singular ), | |
'meta_key' => 'post_content', | |
'post_content' => TRUE, | |
'required' => TRUE | |
), | |
'resume_dashboard_url' => array( | |
'label' => sprintf( __( '%s Dashboard URL', 'wp-job-manager-emails' ), $singular ), | |
'description' => sprintf( __( 'URL to the %s Dashboard', 'wp-job-manager-emails' ), $singular ), | |
'nonmeta' => TRUE | |
), | |
'resume_url' => array( | |
'label' => sprintf( __( '%s URL', 'wp-job-manager-emails' ), $singular ), | |
'description' => sprintf( __( '%s frontend URL (to view only when resume is published)', 'wp-job-manager-emails' ), $singular ), | |
'nonmeta' => TRUE | |
), | |
'view_resume_url' => array( | |
'label' => sprintf( __( 'View %s URL', 'wp-job-manager-emails' ), $singular ), | |
'description' => sprintf( __( '%s share link URL (to view resume regardless of status)', 'wp-job-manager-emails' ), $singular ), | |
'nonmeta' => TRUE | |
), | |
'view_resume_url_admin' => array( | |
'label' => sprintf( __( '%s Admin URL', 'wp-job-manager-emails' ), $singular ), | |
'description' => sprintf( __( '%s Admin Area Edit/View URL', 'wp-job-manager-emails' ), $singular ), | |
'nonmeta' => TRUE | |
), | |
'resume_fields' => array( | |
'label' => sprintf( __( 'All %s Fields', 'wp-job-manager-emails' ), $singular ), | |
'description' => sprintf( __( 'Will output all %s in list format', 'wp-job-manager-emails' ), $singular ), | |
'callback' => 'output_all_fields', | |
'nonmeta' => TRUE | |
), | |
'new_resume_recipient' => array( | |
'label' => sprintf( __( 'New %s Recipient', 'wp-job-manager-emails' ), $singular ), | |
'description' => sprintf( __( 'Value of the "Notify Email Address(es)" Resume Manager setting, if set, otherwise the admin email.', 'wp-job-manager-emails' ), $singular ), | |
'nonmeta' => TRUE | |
), | |
'resume_author_email' => array( | |
'label' => __( 'Resume Author Email', 'wp-job-manager-emails' ), | |
'description' => __( 'Email address of the author who submitted the resume listing', 'wp-job-manager-emails' ), | |
'callback' => 'resume_author_email', | |
'nonmeta' => TRUE | |
), | |
'resume_expires' => array( | |
'label' => sprintf( __( '%s Expires Date' ), $singular ), | |
'description' => __( 'Will output the expiration date' ), | |
'nonmeta' => TRUE, | |
'callback' => 'resume_expires' | |
), | |
'featured' => array( | |
'label' => sprintf( __( '%s Featured' ), $singular ), | |
'description' => __( 'Whether or not a listing is a featured listing' ), | |
) | |
) | |
); | |
$this->shortcodes = $shortcodes; | |
return $shortcodes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment