Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@JiveDig
JiveDig / functions.php
Last active May 20, 2019 17:52
Remove taxonomies that you probably won't need, and take forever to load all the terms in ACF taxonomy field.
<?php
/**
* Remove taxonomies that you probably won't need, and take forever to load all the terms in ACF taxonomy field.
*
* @version 1.0.0
* @author @JiveDig
* @uses Advanced Custom Fields
*
* @param array $taxonomies The existing taxonomies.
@JiveDig
JiveDig / functions.php
Last active May 15, 2019 13:31
Create a direct to cart/checkout/page add to cart button in WooCommerce.
<?php
/**
* Create a direct to cart/checkout/page add to cart button.
*
* Example: [buy_now id="1234" redirect="checkout"]
*
* @version 1.0.0
* @author @JiveDig
* @link https://gist.github.com/JiveDig/6adde04666c189b6089fcfeca4988c47
@JiveDig
JiveDig / functions.php
Created March 28, 2019 14:24
Autocomplete WooCommerce orders that contain only virtual products.
<?php
/**
* Autocomplete orders that contain only virtual products.
* If the order contains a non-virtual product the order will not be completed by this function.
*
* @author Mike Hemberger @JiveDig
*
* @version 1.0.0
*
@JiveDig
JiveDig / wp_enqueue_scripts.php
Last active February 22, 2019 17:54
What happens when you try to enqueue a script in WordPress with the same handle or file name and location?
<?php
$dir = get_stylesheet_directory_uri();
// Different scripts: Both are loaded.
wp_enqueue_script( 'test-one', $dir . '/assets/js/test-one.js', array(), '1.0.0', true );
wp_enqueue_script( 'test-two', $dir . '/assets/js/test-two.js', array(), '1.0.0', true );
// Identical scripts: 1 is loaded.
wp_enqueue_script( 'test-one', $dir . '/assets/js/test.js', array(), '1.0.0', true );
@JiveDig
JiveDig / functions.php
Last active December 1, 2022 21:24
Get the primary term of a post, by taxonomy. If Yoast Primary Term is used, return it, otherwise fallback to the first term.
<?php
/**
* Gets the primary term of a post, by taxonomy.
* If Yoast Primary Term is used, return it,
* otherwise fallback to the first term.
*
* @version 1.3.0
*
* @link https://gist.github.com/JiveDig/5d1518f370b1605ae9c753f564b20b7f
@JiveDig
JiveDig / mai-lifestyle-homepage.json
Created October 15, 2018 20:55
Mai Lifestyle Pro Homepage demo import JSON
{"home_url":"https:\/\/maitheme.com\/mai-lifestyle-pro","layout":"full-width-content","banner_id":false,"hide_banner":"0","hide_breadcrumbs":"0","hide_featured":"1","excerpt":"Mai Lifestyle Pro is among StudioPress' top-3 best selling themes for the last five months in a row, Mai Theme is currently powering some of the most high-traffic websites on the Internet.","images":{"618":"https:\/\/maitheme.com\/mai-lifestyle-pro\/wp-content\/uploads\/2017\/05\/brooke-cagle-199262.jpg","1573":"https:\/\/maitheme.com\/mai-lifestyle-pro\/wp-content\/uploads\/2018\/01\/brooke-cagle-157923.jpg"},"sections":[{"bg":"#f0f0f0","image_id":"","image":false,"overlay":"","inner":"","height":"xs","content_width":"sm","align_content":"","align":"center","text_size":"xl","id":"","class":"","context":"","title":"","content":"<em>\u201cThe Perfect Theme for Wellness, Food\/Recipe, Fitness, Lifestyle, or Small Business Websites and Blogs.\u201d<\/em>"},{"bg":"#ffffff","image_id":"","image":false,"overlay":"","inner":"","height":"lg","c
{"home_url":"https:\/\/maitheme.com\/mlpexport","layout":"full-width-content","banner_id":false,"hide_banner":"0","hide_breadcrumbs":"0","hide_featured":"1","excerpt":"","images":{"618":"https:\/\/maitheme.com\/mlpexport\/wp-content\/uploads\/2017\/05\/brooke-cagle-199262.jpg","1573":"https:\/\/maitheme.com\/mlpexport\/wp-content\/uploads\/2018\/01\/brooke-cagle-157923.jpg"},"sections":[{"bg":"#f0f0f0","image_id":"","image":false,"overlay":"","inner":"","height":"xs","content_width":"sm","align_content":"","align":"center","text_size":"xl","id":"","class":"","context":"","title":"","content":"<em>\u201cThe Perfect Theme for Wellness, Food\/Recipe, Fitness, Lifestyle, or Small Business Websites and Blogs.\u201d<\/em>"},{"bg":"#ffffff","image_id":"","image":false,"overlay":"","inner":"","height":"lg","content_width":"","align_content":"","align":"center","text_size":"","id":"latest-posts","class":"","context":"","title":"Latest Posts","content":"Read our latest tips, tricks, and musings below.\r\n\r\n[grid cont
@JiveDig
JiveDig / social-warfare-genesis.php
Last active March 28, 2018 18:32
Use Genesis hooks to display Social Warfare icons based on SW settings.
<?php
/**
* Use Genesis hooks to display Social Warfare icons based on SW settings.
*
* @version 1.1.0
*
* @author Mike Hemberger @JiveDig
*
* @return void
@JiveDig
JiveDig / branding-mai-theme.css
Last active March 19, 2018 20:32
Mai Theme branding colors CSS
/**
* The code in the following files will allow you to quickly customize the colors/branding of your Mai Theme powered website.
* Add the code to the theme's style.css file and adjust the colors as-needed.
*/
@JiveDig
JiveDig / mai-theme-more-link.php
Created March 14, 2018 15:58
Filter the Read More text in Mai Theme.