Skip to content

Instantly share code, notes, and snippets.

add_filter( 'submit_resume_form_fields', 'custom_submit_resume_form_fields' );
function custom_submit_resume_form_fields( $fields ) {
$fields['resume_fields']['candidate_education']['required'] = true;
$fields['resume_fields']['candidate_education']['fields']['notes']['label'] = 'Additional Comments';
$fields['resume_fields']['candidate_experience']['fields']['notes']['label'] = 'Achievements';
return $fields;
}
add_filter( 'wc_order_is_editable', 'wcs_custom_order_status_edit', 10, 1 );
function wcs_custom_order_status_edit( $order ) {
$edit = ( in_array( $order->get_status(), array( 'pending', 'on-hold', 'auto-draft', 'quote' ) ) ? true : false;
return $edit;
}
function custom_list_of_myme_types( $mime_types ) {
$mime_types = array(
'pdf' => 'application/pdf',
'doc' => 'application/msword',
);
return $mime_types;
}
add_filter('upload_mimes', 'custom_list_of_myme_types', 1, 1);
@bryceadams
bryceadams / gist:98ca5e33701b4831f256
Last active August 5, 2017 21:11
JavaScript get URL params
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
function resume_published_send_email($post_id) {
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$message = "
Hi ".$author->display_name.",
Your listing, ".$post->post_title." has just been approved at ".get_permalink( $post_id ).". Well done!
";
wp_mail($author->user_email, "Your job listing is online", $message);
}
function listing_published_send_email($post_id) {
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$message = "
Hi ".$author->display_name.",
Your listing, ".$post->post_title." has just been approved at ".get_permalink( $post_id ).". Well done!
";
wp_mail($author->user_email, "Your job listing is online", $message);
}
@bryceadams
bryceadams / gist:221d9703f8fc0842887e
Created February 18, 2015 02:52
WooCommerce no shipping available for certain products
function wcs_no_specific_shipping( $rates ) {
global $woocommerce;
// set the product ids that are eligible
$eligible = array( '963' );
// get cart contents
$cart_items = $woocommerce->cart->get_cart();
// loop through the items looking for one in the eligible array
@bryceadams
bryceadams / gist:4cd7940fc51e39d9a7ce
Last active August 29, 2015 14:15
WP Job Manager (Applications) - New Application email to candidate with attachment
<?php
add_action( 'new_job_application', 'send_new_job_application_confirmation', 10, 2 );
function send_new_job_application_confirmation( $application_id, $job_id ) {
$candidate_email = get_post_meta( $application_id, '_candidate_email', true );
$message = sprintf( "Thanks for your application for '%s'. We'll get back to you as soon as possible.", get_the_title( $job_id ) );
$headers = array( 'From: Your Name <[email protected]>' );
$attachments = array( WP_CONTENT_DIR . '/uploads/file_to_attach.zip' ); // Direct link to a file you want to attach
// Hook into user_has_cap filter. This assumes you have setup resumes to require the capability 'has_active_job_package'
add_filter( 'user_has_cap', 'has_active_job_package_capability_check', 10, 3 );
/**
* has_active_job_package_capability_check()
*
* Filter on the current_user_can() function.
*
* @param array $allcaps All the capabilities of the user
* @param array $cap [0] Required capability
add_filter( 'submit_resume_form_fields', 'edit_submit_resume_edu_qual_field' );
function edit_submit_resume_edu_qual_field( $fields ) {
$fields['resume_fields']['candidate_education']['fields']['qualification']['label'] = "Degree(s)";
return $fields;
}