Skip to content

Instantly share code, notes, and snippets.

View sheabunge's full-sized avatar
😴

Shea Bunge sheabunge

😴
View GitHub Profile
@sheabunge
sheabunge / dl-file.php
Last active August 29, 2015 14:07 — forked from hakre/dl-file.php
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
import sublime, sublime_plugin, os, subprocess
class ConemuCommand(sublime_plugin.TextCommand):
def run(self, edit):
if os.name == "nt":
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
process = subprocess.Popen(('c:/Program Files (x86)/ConEmu/ConEmu.exe', '/single', self.view.file_name()),
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public
@sheabunge
sheabunge / remove-title-prefix.php
Last active December 20, 2015 00:39 — forked from WerdsWords/protected_title_format.php
Removes the 'Members Only' title prefix from password-protected posts.
<?php
/**
* Removes the 'Members Only' prefix from password-protected posts
*
* @see get_the_title()
*
* @param string $protected Text prefixed to the title for password-protected posts.
*
* @return string The filtered prefix text.
*/
@sheabunge
sheabunge / vertical-centered.css
Last active December 17, 2015 03:48 — forked from LeaVerou/dabblet.css
Vertical centering with Flexbox
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@sheabunge
sheabunge / allow-svg-upload.php
Last active December 15, 2015 15:09 — forked from ocean90/svg.php
Allows you to upload SVG files through the WordPress media uploader.
<?php
/**
* Plugin Name: Allow SVG Uploads
* Plugin URI: http://wordpress.stackexchange.com/q/94003/19726
* Description: Allows you to upload SVG files through the WordPress media uploader.
* Author: Shea Bunge
* Author URI: http://bungeshea.com
* Version: 1.0
*/
@sheabunge
sheabunge / jquery-boilerplate.js
Created March 22, 2013 01:14 — forked from tommcfarlin/jquery-boilerplate.js
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.
(function( $ ) {
"use strict";
$(function() {
// Your code here
});
<?php
/**
* Change Admin URL
*
* Copyright (C) 2010 hakre <http://hakre.wordpress.com/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
@sheabunge
sheabunge / sunrise.php
Created November 7, 2012 20:01 — forked from chrisguitarguy/sunrise.php
A `sunrise.php` drop in that (mostly) allows custom domains in WordPress multisite. Still needs some more work, but it gets the job done.
<?php
/**
* A sunrise.php drop in that allows you to use WordPress' built in `domain`
* and `path` settings for MultiSite blogs.
*
* Some limitations:
* - Using this with a MS install and paths (not subdomains) does some
* weird stuff when updating `siteurl` and `home` while updating domain.
* So you'll you'll have to update those separately. There are probably
* filters to fix this.
@sheabunge
sheabunge / shortcode-exists.php
Last active June 28, 2017 04:29 — forked from r-a-y/shortcode.php
Check if a shortcode exists in WordPress
<?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.
*
* @param string $shortcode The name of the shortcode to check