Skip to content

Instantly share code, notes, and snippets.

View davoraltman's full-sized avatar

Davor Altman davoraltman

View GitHub Profile
@davoraltman
davoraltman / 0_reuse_code.js
Created March 22, 2016 15:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
$str .= '<p class="comment-subscription-form"><input type="checkbox" checked name="subscribe_comments" id="subscribe_comments" value="subscribe" style="width: auto; -moz-appearance: checkbox; -webkit-appearance: checkbox;"' . $comments_checked . ' /> ';
function get_category_jobs_daki() {
$term = get_term( 31, 'job_listing_category' );
$slug = $term->slug;
$posts = get_posts('job_listing_category=' . $slug . '&post_type=job_listing');
return $count = count($posts);
}
function listing_expired_send_email( $new_status, $old_status, $post ) {
if ( 'job_listing' !== $post->post_type || 'expired' !== $new_status || $old_status === $new_status ) {
return;
}
$author = get_userdata( $post->post_author );
$message = "
Hi " . $author->display_name . ",
Your listing, " . $post->post_title . " has now expired: " . get_permalink( $post_id );
wp_mail( $author->user_email, "Your job listing has expired", $message );
// Add your own function to filter the fields
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields' );
// This is your function which takes the fields, modifies them, and returns them
// You can see the fields which can be changed here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/forms/class-wp-job-manager-form-submit-job.php
function custom_submit_job_form_fields( $fields ) {
// Here we target one of the job fields (job_title) and change it's label
$fields['job']['job_description']['description'] = "Note: Use headings to make your advert stand out. To see example headings and listing <a href='http://example.com'>click here</a>.";
@davoraltman
davoraltman / functions.php
Created June 27, 2017 12:28
Make custom meta field searchable
function my_wpjm_meta_key_dm() {
global $wpdb, $job_manager_keyword;
$searchable_meta_keys[] = '_my_meta_field';
return $searchable_meta_keys;
}
add_filter('job_listing_searchable_meta_keys', 'my_wpjm_meta_key_dm');
@davoraltman
davoraltman / functions.php
Last active July 3, 2017 16:26
Change From details in the Application email in WPJM
add_filter('create_job_application_notification_headers','daki_job_application_headers');
function daki_job_application_headers($headers) {
$headers[] = 'From: ' . 'Salon Express' . ' <info@salonexpress.com.au>';
return $headers;
}
@davoraltman
davoraltman / functions.php
Last active July 3, 2017 16:38
Change the From details in the Application email
add_filter('create_job_application_notification_headers','dm_job_application_headers');
function dm_job_application_headers($headers) {
$headers[] = 'From: ' . 'My Custom From Name' . ' <example@example.com>';
return $headers;
}
@davoraltman
davoraltman / functions.php
Last active July 4, 2017 09:03
Change the From: details for the Applications Candidate notification
add_filter('create_job_application_candidate_notification_headers','dm_job_candidate_application_headers');
function dm_job_candidate_application_headers($headers) {
$headers[] = 'From: ' . 'My Custom From Name' . ' <example@example.com>';
return $headers;
}
@davoraltman
davoraltman / functions.php
Created July 7, 2017 06:53
Add a custom start date field displayed to the single job listing
/** added to functions.php to create Start Date field **/
add_filter( 'submit_job_form_fields', 'frontend_add_start_field' );
function frontend_add_start_field( $fields ) {
$fields['job']['job_start'] = array(
'label' => __( 'Start', 'job_manager' ),
'type' => 'text',
'required' => true,
'placeholder' => 'eg March 2017',