Skip to content

Instantly share code, notes, and snippets.

View tomjn's full-sized avatar
🎯
Focusing

Tom J Nowell tomjn

🎯
Focusing
View GitHub Profile
#!/bin/bash
# Takes a composer controlled repo and pushes a
# composed PACKAGE into a branch called "PACKAGE".
(
# SANITY CHECKS
# Check for uncommitted changes, and refuse to proceed if there are any
if [ -n "$(git ls-files . --exclude-standard --others)" ]; then
@tomjn
tomjn / shortcode.php
Last active December 16, 2015 09:09 — forked from r-a-y/shortcode.php
Always ommit trailing php close tags, indent correctly, and remove the IDE unfriendly shorthand
<?php
if ( ! function_exists( 'shortcode_exists' ) ) {
/**
* Check if a shortcode is registered in WordPress.
*
* Examples: shortcode_exists( 'caption' ) - will return true.
* shortcode_exists( 'blah' ) - will return false.
*/
function shortcode_exists( $shortcode = false ) {
global $shortcode_tags;
@tomjn
tomjn / gist:4996601
Last active December 14, 2015 00:09 — forked from anonymous/gist:4996553
<?php
if ( function_exists( 'contact_detail' ) ) {
$chair = contact_detail( 'chair' );
$address = contact_detail( 'address' );
}
@tomjn
tomjn / gist:4148899
Created November 26, 2012 15:51 — forked from jmdodd/gist:4055427
Set Twitter language for WordPress oEmbeds
global $wp_version;
if ( version_compare( $wp_version, '3.5', 'ge' ) ) {
if ( !function_exists( 'ucc_oembed_twitter_lang' ) ) {
function ucc_oembed_twitter_lang( $provider, $url, $args ) {
if ( stripos( $url, 'twitter.com' ) ) {
if ( defined( 'WPLANG' ) )
$lang = strtolower( WPLANG );
if ( empty( $lang ) )
$lang = 'en';