Skip to content

Instantly share code, notes, and snippets.

@danjjohnson
danjjohnson / functions.php
Created July 19, 2016 15:37 — forked from chaselivingston/gist:2569f4f1b2435451ca99de3d898395e6
Jetpack: Disable carousel for a specific post only
function cl_tweak_carousel( $extra_data ) {
global $post;
if ( $post->ID == 23 ) {
$extra_data = array();
}
return $extra_data;
}
add_filter( 'jp_carousel_add_data_to_container', 'cl_tweak_carousel');
@danjjohnson
danjjohnson / functions.php
Last active January 18, 2017 17:04 — forked from bryceadams/gist:ee0a1c65d8ecf6015bb6
WPJM: Send an email to employer when their job is approved.
function listing_published_send_email($post_id) {
if( 'job_listing' != get_post_type( $post_id ) ) {
return;
}
$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!
@danjjohnson
danjjohnson / gist:f1fa639ba5e5e44c4d161161b52a3bfa
Last active September 20, 2017 22:17 — forked from bryceadams/gist:368d3396d72ca8e4b1da
Add a field to resume submission form in WPJM Resume Manager
// Add field to admin
add_filter( 'resume_manager_resume_fields', 'wpjms_admin_resume_form_fields' );
function wpjms_admin_resume_form_fields( $fields ) {
$fields['_candidate_color'] = array(
'label' => __( 'Favourite Color', 'job_manager' ),
'type' => 'text',
'placeholder' => __( 'Blue', 'job_manager' ),
'description' => '',
'priority' => 1
@danjjohnson
danjjohnson / 0_reuse_code.js
Created March 24, 2016 14:51
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
// Add product categories to the "Product" breadcrumb in WooCommerce.
// Get breadcrumbs on product pages that read: Home > Shop > Product category > Product Name
add_filter( 'woo_breadcrumbs_trail', 'woo_custom_breadcrumbs_trail_add_product_categories', 20 );
function woo_custom_breadcrumbs_trail_add_product_categories ( $trail ) {
if ( ( get_post_type() == 'product' ) && is_singular() ) {
global $post;
$taxonomy = 'product_cat';