Skip to content

Instantly share code, notes, and snippets.

@danjjohnson
danjjohnson / gist:7bcadb2d30fb28c72df88a5d8e1a9daa
Created Dec 4, 2019
WPJM Applications: Change posts per page for past applications shortcode
View gist:7bcadb2d30fb28c72df88a5d8e1a9daa
add_filter( 'job_manager_job_applications_past_args', 'change_past_application_args');
function change_past_application_args( $args ) {
$args['posts_per_page'] = 5; // Number of past applications to display on each page.
$args['offset'] = ( max( 1, get_query_var( 'paged' ) ) - 1 ) * $args['posts_per_page'];
return $args;
}
View gist:0104476b2554ed2ac574fb30e1af1f18
function change_resume_slug( $args ) {
$args['rewrite']['slug'] = _x( 'cv', 'Resume permalink - resave permalinks after changing this', 'wp_job_manager_resumes' );
return $args;
}
add_filter( 'register_post_type_resume', 'change_resume_slug' );
@danjjohnson
danjjohnson / gist:5ab128f246e7af26fba5b097717c7dab
Created Dec 3, 2019
WPJM: Show hidden WooCommerce products when selecting a job package
View gist:5ab128f246e7af26fba5b097717c7dab
add_filter( 'wcpl_get_job_packages_args', 'bk_show_hidden_job_packages');
function bk_show_hidden_job_packages( $args ) {
unset( $args['tax_query'][1] );
return $args;
}
@danjjohnson
danjjohnson / functions.php
Created Oct 16, 2019
Change the default Job Type in job submission form
View functions.php
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields' );
function custom_submit_job_form_fields( $fields ) {
$fields['job']['job_type']['default'] = "freelance";
return $fields;
}
@danjjohnson
danjjohnson / gist:142e2f94be95b6a2b2f758164d3dc71c
Last active Sep 29, 2019
Change WC Paid Listings grace period
View gist:142e2f94be95b6a2b2f758164d3dc71c
function job_manager_set_allowed_deletion_period() {
return 3;
}
add_filter( 'job_manager_job_listing_allowed_deletion_period', 'job_manager_set_allowed_deletion_period' );
@danjjohnson
danjjohnson / applications-recaptcha
Created Sep 9, 2019
Add recaptcha support for WPJM Applications.
View applications-recaptcha
<?php
// Define your keys here
define( 'RECAPTCHA_SITE_KEY', 'XXX' );
define( 'RECAPTCHA_SECRET_KEY', 'XXX' );
// Enqueue Google reCAPTCHA scripts
add_action( 'wp_enqueue_scripts', 'recaptcha_scripts' );
function recaptcha_scripts() {
wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js' );
View functions.php
add_filter( 'woocommerce_box_office_scan_permission', 'modify_woocommerce_box_office_scan_permission' );
function modify_woocommerce_box_office_scan_permission( $has_permission ) {
// Do any required permission checks here
$has_permission = true;
return $has_permission;
}
@danjjohnson
danjjohnson / gist:887ed4b28dcd9f5963a247539d4fb47a
Created Oct 19, 2017
WooCommerce Product Add-ons - Set checkboxes to checked by default
View gist:887ed4b28dcd9f5963a247539d4fb47a
// Set checkboxes to checked by default
jQuery(document).ready(function(){
jQuery('.addon-checkbox').attr( 'checked', 'checked' );
});
@danjjohnson
danjjohnson / gist:cc1d8eea8d9736534bbcd8ae0068644e
Last active Jun 9, 2017
Add 'position-filled' body class on filled single listings
View gist:cc1d8eea8d9736534bbcd8ae0068644e
add_filter( 'body_class', 'dj_add_position_filled_class' );
function dj_add_position_filled_class( $classes ) {
global $post;
if ( $post->post_type !== 'job_listing' ) {
return $classes;
}
if ( is_position_filled( $post ) ) {
$classes[] = 'position-filled';
}
@danjjohnson
danjjohnson / gist:8424a87c691231d2699b2a9904a3c7af
Created Jun 8, 2017
WPJM - change the job-category and job-type slugs
View gist:8424a87c691231d2699b2a9904a3c7af
// Change the 'job-category' slug
add_filter( 'register_taxonomy_job_listing_category_args', 'change_job_listing_category_rewrite' );
function change_job_listing_category_rewrite( $options ) {
$options['rewrite'] = array(
'slug' => 'industria',
'with_front' => false,
'hierarchical' => false,
);
return $options;