Skip to content

Instantly share code, notes, and snippets.

@bmoredrew
bmoredrew / mq.css
Created October 3, 2012 18:59 — forked from chriscoyier/mq.css
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
@bmoredrew
bmoredrew / gist:4120398
Created November 20, 2012 19:24 — forked from retlehs/gist:4120053
Remove unnecessary markup from WooCommerce
<?php
/**
* Remove unnecessary markup from WooCommerce:
*
* 1. Remove <meta name="generator" content="WooCommerce (version)" />
* 2. Remove the addition of <body class="theme-themename">
*/
function woocommerce_head_cleanup() {
global $woocommerce;
<?php
/**
* Return a custom field stored by the Advanced Custom Fields plugin
*
* @global $post
* @param str $key The key to look for
* @param mixed $id The post ID (int|str, defaults to $post->ID)
* @param mixed $default Value to return if get_field() returns nothing
* @return mixed
* @uses get_field()
<?php
/**
* Custom PayPal Adaptive Payments args.
*
* @param array $args
* @param WC_Order $order
* @return array
*/
function custom_woocommerce_paypal_ap_payment_args( $args, $order ) {
$args['receiverList'] = array(
@bmoredrew
bmoredrew / acf_get_directions.php
Created August 9, 2016 05:43 — forked from mattradford/acf_get_directions.php
ACF Get Directions map link
<a class="directions" href="https://www.google.com/maps?saddr=My+Location&daddr=<?php $location = get_field('map_location'); echo $location['lat'] . ',' . $location['lng']; ?>"><?php _e('Get Directions','roots'); ?></a>
@bmoredrew
bmoredrew / jquery-boilerplate.js
Created August 30, 2017 13:38 — forked from tommcfarlin/jquery-boilerplate.js
[WordPress] Properly loading jQuery within WordPress without having to use the `noConflict` method, or creating your own reference such as `$wp = jQuery`.
/**
* This gist demonstrates how to properly load jQuery within the context of WordPress-targeted JavaScript so that you don't
* have to worry about using things such as `noConflict` or creating your own reference to the jQuery function.
*
* @version 1.0
*/
(function( $ ) {
"use strict";
$(function() {
@bmoredrew
bmoredrew / Arr.php
Created September 6, 2017 21:12
PHP: Array support class and functions
<?php
/**
* Support class for working with arrays.
*/
class Arr
{
/**
* Extend an associative array.
*
@bmoredrew
bmoredrew / WordPress get_the_ID() replacement.md
Created December 14, 2017 16:41 — forked from morganestes/ WordPress get_the_ID() replacement.md
Get the WordPress post ID no matter where you are.

This extends the built-in WordPress function get_the_ID() to return the post ID both inside and outside the loop.

Used outside the loop (in header.php):

<?php if ( function_exists( 'gt_hide_nav' ) && ! gt_hide_nav() ) : ?>
  <nav role="navigation">
    <?php if ( function_exists( 'bones_main_nav' ) ) bones_main_nav(); ?>
  </nav>
<?php
/*
Plugin Name: Sizeable Whitelist Login
Author: Sizeable Interactive
Author URI: https://www.sizeableinteractive.com
Version: 0.1
Description: Server agnostic plugin to white list WordPress login screen to IP addresses using a self-authenticating secret URL.
**** NOTE ***
You must define the SZBL_SECRET_LOGIN_URL or set a login URL in the settings page for this plugin to take affect.
@bmoredrew
bmoredrew / index.php
Last active April 2, 2019 18:06 — forked from lepittenger/index.php
Check if the_content is empty
<?php
if ( $post->post_content=="" )
{
// do something for posts without content
}
else
{
// do something for posts with content
};