Skip to content

Instantly share code, notes, and snippets.

View aibrean's full-sized avatar

April Sadowski aibrean

View GitHub Profile
@aibrean
aibrean / css_resources.md
Created June 6, 2014 15:22 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

<?php
/**
* Remove inactive shortcodes
*
* Make sure inactive shortcodes don't leave their junk in the content.
* We are striping their tags, leaving content as is. This function is attached to
* 'the_content' filter hook.
*
* @global $shortcode_tags Associative array of all active shortcodes.
* [key] => value
@aibrean
aibrean / acf-radio-button-example.php
Last active August 29, 2015 14:06 — forked from emaildano/acf-radio-button-example.php
ACF radio button outputs
<?php $program = get_sub_field('program_selection'); ?>
<?php if( $program == 'intensity' ){ ?>
<?php } else if( $program == 'crossfit' ){ ?>
<?php } else if( $program == 'personal' ){ ?>
<?php } else if( $program == 'allprograms' ){ ?>
@aibrean
aibrean / ACF Radio conditional.php
Last active August 29, 2015 14:22 — forked from fosturgh/Conditional ACF Menu
Conditional Options
<?php if(get_field('some-field', 'option') == 'on') { ?>
<?php } else { ?>
<?php } ?>
@aibrean
aibrean / header.php
Last active August 29, 2015 14:27 — forked from retlehs/header.php
Sage header template for Bootstrap top navbar component
<?php
// This file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker
// somewhere in your theme.
?>
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
@aibrean
aibrean / woocommerce-optimize-scripts.php
Last active September 18, 2015 15:15 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@aibrean
aibrean / gist:d6ea5a7ce3f46e4c7515
Created October 6, 2015 15:40 — forked from corsonr/gist:6725310
WooCommerce - Redirect add to cart to checkout page
<?php
add_filter ('woocommerce_add_to_cart_redirect', 'woo_redirect_to_checkout');
function woo_redirect_to_checkout() {
$checkout_url = WC()->cart->get_checkout_url();
return $checkout_url;
}
@aibrean
aibrean / force-ssl-url-scheme.php
Created January 18, 2016 18:08 — forked from webaware/force-ssl-url-scheme.php
For WordPress, force the protocol scheme to be HTTPS when is_ssl() doesn't work, e.g. on a load-balanced server where _SERVER['HTTPS'] and _SERVER['SERVER_PORT'] don't indicate that SSL is being used. See http://wordpress.org/support/topic/ssl-insecure-needs-35-compatibility for details.
<?php
/*
Plugin Name: Force SSL URL Scheme
Plugin URI: https://gist.github.com/webaware/4688802
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work
Version: 1.0.0
Author: WebAware
Author URI: http://www.webaware.com.au/
@ref: http://wordpress.org/support/topic/ssl-insecure-needs-35-compatibility
@aibrean
aibrean / create-image-id.php
Created March 10, 2016 16:25 — forked from joshuadavidnelson/create-image-id.php
Programmatically create the image attachment and return the new media upload id.
<?php
/**
* Create the image attachment and return the new media upload id.
*
* @author Joshua David Nelson, josh@joshuadnelson.com
*
* @see http://codex.wordpress.org/Function_Reference/wp_insert_attachment#Example
*
* @link https://joshuadnelson.com/programmatically-add-images-to-media-library/
*
@aibrean
aibrean / set-post-fields-gf.php
Created March 10, 2016 16:25 — forked from joshuadavidnelson/set-post-fields-gf.php
Connect a Gravity Form upload field to ACF Gallery Field when creating a front-end post submission, requires the jdn_create_image_id function from https://gist.github.com/joshuadavidnelson/164a0a0744f0693d5746
<?php
/**
* Attach images uploaded through Gravity Form to ACF Gallery Field
*
* @author Joshua David Nelson, josh@joshuadnelson.com
* @return void
*/
$gravity_form_id = 1; // gravity form id, or replace {$gravity_form_id} below with this number
add_filter( "gform_after_submission_{$gravity_form_id}", 'jdn_set_post_acf_gallery_field', 10, 2 );
function jdn_set_post_acf_gallery_field( $entry, $form ) {