Skip to content

Instantly share code, notes, and snippets.

@kraftbj
kraftbj / functions.php
Created January 21, 2016 20:55
Preset location
add_filter( 'job_manager_get_listings_args', 'bk_change_location' );
function bk_change_location( $args ){
$args['search_location'] = 'Anywhere, USA'; // location as a string.
return $args;
}
@kraftbj
kraftbj / functions.php
Last active January 13, 2016 22:48
Edit Application Statuses
add_filter( 'job_application_statuses', 'bk_change_app_status' );
function bk_change_app_status( $status ){
unset( $status['new'] ); // example of how to remove one of the built-in ones of new, interviewed, offer, hired, archived
$status['campus-visit'] = "Campus Visit"; // example of how to add a new one
$status['hired'] = "Appointed"; // example of how to "rename" an existing one if you don't want to impact existing ones.
return $status;
@kraftbj
kraftbj / functions.php
Created January 13, 2016 22:02
Include all packages
add_filter( 'wcpl_get_resume_packages_args', 'bk_show_all_packages' );
add_filter( 'wcpl_get_job_packages_arg', 'bk_show_all_packages' );
function bk_show_all_packages( $args ){
unset( $args['meta_query']);
return $args;
}
@kraftbj
kraftbj / ps.js
Created January 13, 2016 15:48
pushstate listener to grab when IS changes URL
function pushStateListener() {
var pushState = history.pushState;
history.pushState = function() {
pushState.apply(history, arguments);
$(window).trigger('pushState');
};
$(window).on('pushState', function() {
alert(String(window.location).match(/.+\/(\d+)(?=\/$)/)[1]);
//Returns page number
@kraftbj
kraftbj / functions.php
Created December 18, 2015 20:38
Change Jetpack default OG image
<?php // remove if in an existing file.
add_filter( 'jetpack_open_graph_image_default', 'example_change_default_image' );
function example_change_default_image( $image ) {
return 'https://s0.wp.com/i/blank.jpg';
}
@kraftbj
kraftbj / functions.php
Created December 2, 2015 20:39
Log shutdown after sync
add_action( 'transition_post_status' , 'log_after_sync_on_shutdown');
function log_after_sync_on_shutdown(){
add_action( 'shutdown' , 'log_message_priority_11' , 11 );
}
function log_message_priority_11( ) {
_log('Message post from shutdown priority 11.');
}
@kraftbj
kraftbj / functions.php
Created November 30, 2015 20:05
Log an error at shutdown priority 11 to confirm that is firing.
<?php
add_action( 'transition_post_status', 'bk_shutdown', 11);
function bk_shutdown() {
add_action('shutdown', 'bk_let_the_record_show', 11);
}
function bk_let_the_record_show(){
error_log( 'Shutdown at 11');
}
@kraftbj
kraftbj / functions.php
Last active November 20, 2015 22:22
Force Publicize's post editor settings to expand.
<?php // do not include in an existing PHP file or you can upload this entire file as a plugin.
/*
* Plugin Name: Jetpack: Auto-Expand Publicize Settings
* Plugin URI: http://jetpack.me
* Description: Custom plugin to auto-expand the Publicize settings when writing a post.
* Author: Brandon Kraft
* Version: 1.0.0
* Author URI: https://kraft.im/
* License: GPL2+
*/
@kraftbj
kraftbj / functions.php
Created November 9, 2015 15:51
Indeed Customization
add_filter( 'job_manager_indeed_get_jobs_args', 'bk_custom_args');
function bk_custom_args( $args ){
$args['as_not'] = 'the-query-value-here';
return $args;
}
@kraftbj
kraftbj / admin.js
Created October 30, 2015 18:10
wpjm-rm admin js
jQuery(document).ready(function($) {
// Data rows
$( "input.resume_manager_add_row" ).click(function(){
$(this).closest('table').find('tbody').append( $(this).data('row') );
return false;
});
// Sorting
$('.wc-job-manager-resumes-repeated-rows tbody').sortable({
items:'tr',