Skip to content

Instantly share code, notes, and snippets.

View daronspence's full-sized avatar

Daron daronspence

View GitHub Profile
@daronspence
daronspence / ACF Group Fields.php
Last active August 29, 2015 14:06
ACF Group Fields
<?php
/**
* acf_group_fields
*
* This function return an array of all the field names within a field group.
*
* @type function
* @date 24/9/14
* @since 5.0.8
*
@daronspence
daronspence / Fade & Repeat.js
Last active August 29, 2015 14:06
jQuery Fade Each & Repeat
(function($) {
function fadeloop(){ // loops through elements and fades them sequentially
$('.my-element').each(function( index, element){
$(element).delay(index*4000).fadeIn(500).delay(3000).fadeOut(500);
});
}
function fade(){ // calls itself to repeat
window.setTimeout(fadeloop, 0);
window.setTimeout(fade, 16000);
}
@daronspence
daronspence / WordpressNav.scss
Last active August 29, 2015 14:06
Wordpress Navigation
.main-navigation {
background: #333;
position: fixed;
top: 0;
height: 4.5rem;
width: 100%;
.nav-menu {
@include container();
list-style: none;
}
@daronspence
daronspence / g-map-acf-bug-fix.js
Last active August 29, 2015 14:07
ACF G-Map Bug Fix
// LINE 3927 of input.js
/////////////////////////////
// OLD CODE
////////////////////////////
// update inputs
this.$el.find('.input-lat').val( lat );
this.$el.find('.input-lng').val( lng ).trigger('change');
<?php
$args = array(
// Get children of current page
'post_parent' => $post->ID,
'post_type' => 'page',
);
$query = new WP_Query($args);
<?php
$args = array(
'post_type' => 'morning_show'
);
$actors = new WP_Query($args);
if ( $actors->have_posts() ) : while ( $actors->have_posts() ) : $actors->the_post() :
the_field('actors');
<?php
'location' => array(
array(
array(
'param' => 'widget',
'op' => '==',
'value' => 'pages'
),
array(
'param' => 'widget',
@daronspence
daronspence / is-plugin-installed.php
Created January 29, 2015 00:04
Is plugin installed
$installed_plugins = array();
// check if ACF is installed
if ( is_multisite() ) :
$network_plugins = get_site_option( 'active_sitewide_plugins', array() );
$site_plugins = get_option( 'active_plugins', array() );
$installed_plugins = array_merge($network_plugins, $site_plugins);
else :
@daronspence
daronspence / remove-anonymous-object.php
Last active August 29, 2015 14:14
Remove actions/filters from anonymous class instance
// All of your classes in /acf/forms/ are called anonymously
// so it's near impossible to filter them out without this jargon. :(
// example of won't work, but should
remove_filter('in_widget_form', array('acf_form_widget', 'edit_widget'), 10 );
// See http://wordpress.stackexchange.com/questions/137688/remove-actions-filters-added-via-anonymous-functions
function acfw_remove_object_filter( $tag, $class, $method = NULL, $priority = NULL ) {
$filters = $GLOBALS['wp_filter'][ $tag ];
if ( empty ( $filters ) ) {
// Line 109 from EDD_SL_Changelog_Widget.php
$changelog = apply_filters( 'edd_sl_changeloge_widget_output' , get_post_meta( $post_id, '_edd_sl_changelog', true ) );