Skip to content

Instantly share code, notes, and snippets.

View yellowberri-snippets's full-sized avatar

Dalton Yellowberri yellowberri-snippets

View GitHub Profile
@yellowberri-snippets
yellowberri-snippets / PHP: WP: WP_Query
Last active December 21, 2015 03:29
PHP: WP: WP_Query
<?php
$args = array (
'post_type' => 'post',
'posts_per_page' => -1,
'status' => 'publish'
);
$query = new WP_Query( $args );
?>
@yellowberri-snippets
yellowberri-snippets / PHP: ACF: Basic Image Field
Last active December 21, 2015 18:19
PHP: ACF: Basic Image Field
if ( get_field('image') ) {
$image = get_field('image');
// Some useful keys.
// $image['url'] - Full size image.
// $image['sizes']['medium'] - Medium size image.
// $image['alt'] - Image Alternative text field.
// $image['title'] - Image title field.
// $image['caption'] - Image caption field.
@yellowberri-snippets
yellowberri-snippets / PHP: ACF: Basic Repeater Field
Last active December 21, 2015 18:19
PHP: ACF: Basic Repeater Field
<?php
$repeaterName = 'repeater';
$pageId = NULL; // Just in case.
?>
<?php if ( have_rows( $repeaterName, $pageId ) ) : ?>
<?php while ( have_rows($repeaterName, $pageId) ) : the_row(); ?>
<?php the_sub_field('sub_field_name'); ?>
<?php endwhile; ?>
@yellowberri-snippets
yellowberri-snippets / JS: Class Swap Function
Created September 24, 2013 17:35
JS: Class Swap Function
function classSwap(classOne, classTwo, target) {
if ( $(target).hasClass(classOne) ) {
$(target).removeClass(classOne).addClass(classTwo);
}
else if ( $(target).hasClass(classTwo) ) {
$(target).removeClass(classTwo).addClass(classOne);
}
else {
$(target).addClass(classOne);
}
@yellowberri-snippets
yellowberri-snippets / JS: Place After in Source Order
Last active December 30, 2015 04:49
JS: Place After in Source Order
function placeAfter(element, destination) {
var element = $(element);
element.remove().clone().insertAfter( destination);
}
@yellowberri-snippets
yellowberri-snippets / JS: JQUERY: Add .exists() method
Created December 12, 2013 16:47
JS: JQUERY: Add .exists() method
$.fn.exists = function () {
return this.length !== 0;
};
@yellowberri-snippets
yellowberri-snippets / CSS: Full Width Gravity Form
Last active September 25, 2020 19:21
CSS: Full Width Gravity Forms
.gform_wrapper {
form .gform_body .ginput_complex input[type=text] {
width:100% !important;
}
input, input[type=text], select, textarea {
width:100% !important;
@include box-sizing(border-box);
}
}
@yellowberri-snippets
yellowberri-snippets / JS: JQUERY: breakSetup - Run Code Based on Break Points
Last active December 31, 2015 21:29
JS: JQUERY: breakSetup - Run Code Based on Break Points
var $state;
function breakSetup( $breakwidth, $operator, $callback ) {
var w = $(window),
$width = w.width();
var operators = {
'<' : function( a, b ) { return a < b ; },
'>' : function( a, b ) { return a > b ; },
'<=' : function( a, b ) { return a <= b ; },
function is_empty(&$val) {
return empty($val) && $val !== "0";
}
@yellowberri-snippets
yellowberri-snippets / SASS: Inner Column & Breakpoint Setup
Last active August 29, 2015 13:56
SASS: Inner Column & Breakpoint Setup
$mobileColumn: 400;
$narrowColumn: 700;
$multiColumn: 1000;
$mainWidth: $narrowColumn - 40;
$multiWidth: $multiColumn - 40;
$narrowWidth: 95%;
$mobileWidth: 90%;
@mixin breakpoint($point) {