Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / jquery.script.js
Created October 23, 2017 18:19 — forked from solepixel/jquery.script.js
Vertically and horizontally center Soliloquy slides while still keeping proportions. Emulating the "background-size: cover" with a standard slider. Slider configuration looks like this: Slider Dimensions: Full Width, Slider Position: Center, Use Adaptive Height: Yes, Crop Images in Slider: Yes
(function( $ ){
'use strict';
function auto_fit_soliloquy( parent_selector ){
// resize the slider container
var $soliloquy = $( parent_selector + ' .soliloquy-container'),
$all_items = $('.soliloquy-slider,.soliloquy-viewport,.soliloquy-item', $soliloquy ),
$container = $('.soliloquy-item', $soliloquy ),
window_height = $(window).height();
@jamiemitchell
jamiemitchell / custom-subscription-interval.php
Created September 1, 2017 03:40 — forked from thenbrent/custom-subscription-interval.php
Add a new billing interval to WooCommerce Subscriptions to allow for longer intervals between subscription renewal payments. Specifically a new "8" interval to allow you to sell a subscription that renews every 8 days, weeks, months or years.
<?php
/**
* Plugin Name: WooCommerce Subscription Custom Interval
* Description: Add a custom 8 week subscription interval to WooCommerce Subscriptions
* Author: Brent Shepherd
* Version: 1.0
* License: GPL v2
*/
function eg_add_custom_subscription_interval( $subscription_intervals ) {
@jamiemitchell
jamiemitchell / edd-parent-download-category.php
Created July 4, 2017 09:43 — forked from Creativenauts/edd-parent-download-category.php
Easy Digital Downloads - Get Parent Category For a Download (Exclude Categories as well!)
function get_edd_parent_category() {
global $post;
$terms = wp_get_post_terms(
$post->ID,
'download_category',
array(
'parent' => 0
)
@jamiemitchell
jamiemitchell / gist:d9d512b2067b3f670285a0f92c1a9025
Created July 4, 2017 09:43 — forked from ivandoric/gist:11215439
wordpress: Get parent category of custom taxonomy in Wordpress
<?php $terms = get_the_terms( $post->ID , 'product-category' );
if ( $terms != null ){
foreach( $terms as $term ) {
if($term->parent == 0){
$theterm = $term->slug;
}
unset($term);
} }
?>
@jamiemitchell
jamiemitchell / Readme.md
Created May 23, 2017 09:55 — forked from robert-gillmer/Readme.md
Outputting Recipe CPT's with correct microdata

Recipe CPT and Taxonomy

The code below was written for http://loversofwhisky.com, which recently launched.

It's built on Genesis, and uses Bill Erickson's Core Functionality Plugin to create the custom post type and custom taxonomy.

This also uses the Repeater field in Advanced Custom Fields for the ingredients and the instructions. Instead of using the built-in ACF functions to get the data, I pull it from the custom post meta. See this article for more details.

(Side note, how awesome is Bill Erickson?)

@jamiemitchell
jamiemitchell / functions.php
Created May 23, 2017 09:52 — forked from oalansari82/functions.php
Google Map with Multiple Markers in Genesis using ACF Pro
<?php
add_action( 'init', 'register_cpt_locations' );
/**
* Create Locations custom post type
*/
function register_cpt_locations() {
$labels = array(
'name' => __( 'Locations', 'locations' ),
'singular_name' => __( 'Location', 'locations' ),
@jamiemitchell
jamiemitchell / page_flexible.php
Created May 23, 2017 09:44 — forked from tomfinitely/page_flexible.php
Genesis Flexible ACF Pages
<?php
/**
* Genesis Framework.
*
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
*
* @package Genesis\Templates
* @author StudioPress
* @license GPL-2.0+
@jamiemitchell
jamiemitchell / (Force excerpts on Genesis search results (functons.php) Forces Genesis search results to display excerpts no matter what options are chosen in the theme archive settings. Props to @srikat for this one!
add_action( 'genesis_before_loop', 'sk_excerpts_search_page' );
function sk_excerpts_search_page() {
if ( is_search() ) {
add_filter( 'genesis_pre_get_option_content_archive', 'sk_show_excerpts' );
}
}
function sk_show_excerpts() {
return 'excerpts';
}
@jamiemitchell
jamiemitchell / functions.php
Created May 23, 2017 09:31 — forked from etasi/functions.php
Genesis: Display Featured images above Posts with Title as overlay
//* Register a custom image size for Featured images above entries on list pages
add_image_size( 'archive-featured-image', 800, 300, true );
add_action( 'genesis_before_entry', 'sk_featured_image_above_posts' );
/**
* Display Featured Image above Post Titles regardless of Content Archives settings
*
* Context: Posts page, all archives and search results pages.
*
* @author Sridhar Katakam
<?php
add_action( 'genesis_loop', 'sk_do_loop' );
/**
* Outputs a custom loop
*
* @global mixed $paged current page number if paginated
* @return void
*/
function sk_do_loop() {