Skip to content

Instantly share code, notes, and snippets.

View derekshirk's full-sized avatar
πŸš™
Principal Product Designer at Driveway

Derek Shirk derekshirk

πŸš™
Principal Product Designer at Driveway
View GitHub Profile
@derekshirk
derekshirk / .bash_profile
Last active August 29, 2015 14:23
.bash_profile
# =============================================================== #
# My Personal .bash_profile
# Author: derek shirk
# Website: derekshirk.com
# Subscribe to my newsletter mergelinks.com
# =============================================================== #
# =============================================================== #
# Aliases
@derekshirk
derekshirk / acf-inline-svg.php
Created July 20, 2016 22:14
Output Inline SVGs from ACF image field
<?php
/* β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” */
/* ACF Inline SVGs
/* β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” */
$repeater = 'repeater_field_name'
if ( have_rows( $repeater ) ): ?>
<section class="content-main">
<div class="container"> <?php
@derekshirk
derekshirk / wordpress-better-register-cpt.php
Last active July 26, 2016 16:19
A Better Approach to Registering Custom Post Types for WordPress
<?php /*
/* ------------------------------------------------- */
/* Use Variables to Make Registering CPTs Easier
/* ------------------------------------------------- */
function register_my_cpt_name() {
$name = 'My Custom Post Type' ;
$singular = 'The Custom Post Types' ;
@derekshirk
derekshirk / functions.php
Last active August 10, 2016 20:06
Remove Custom Post Type (name/slug) from permalink url
/**
* Remove the slug from published post permalinks.
* Only affect our CPT though.
*/
function vipx_remove_cpt_slug( $post_link, $post, $leavename ) {
if ( ! in_array( $post->post_type, array( 'event' ) )
|| 'publish' != $post->post_status )
return $post_link;
@derekshirk
derekshirk / image-swap.js
Created August 26, 2019 18:10
Image Swapping with data attributes
import $ from 'jquery';
const NAME = 'swapImage';
const DATA_KEY = `decathlon.${NAME}`;
const EVENT_KEY = `.${DATA_KEY}`;
const ClassName = {
CURRENT: 'is-current',
LOADING: 'is-loading'
};