Skip to content

Instantly share code, notes, and snippets.

@bmoredrew
bmoredrew / .zshrc
Created November 16, 2022 21:02 — forked from zanshin/.zshrc
My .zshrc file
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#export ZSH_THEME="robbyrussell"
export ZSH_THEME="zanshin"
@bmoredrew
bmoredrew / breadcrumbs-list.php
Created August 26, 2022 20:23 — forked from doubleedesign/breadcrumbs-list.php
Mark up Yoast breadcrumbs as an unordered list
<?php
/**
* Filter the output of Yoast breadcrumbs so each item is an <li> with schema markup
* @param $link_output
* @param $link
*
* @return string
*/
function doublee_filter_yoast_breadcrumb_items( $link_output, $link ) {
@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
};
<?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 / 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>
@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 / 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 / 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>
<?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(
<?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()