Skip to content

Instantly share code, notes, and snippets.

View blainerobison's full-sized avatar

Blaine Robison blainerobison

  • Dagrander
  • San Diego
View GitHub Profile
@blainerobison
blainerobison / gist:1f1e59c99f5c9a78b93d
Last active December 17, 2015 22:35
wp: Move Category Count Inside Link [WordPress]
/**
* Move Category Post Counts Inside Link
*
* filters wp_list_categories()
*
* @param string $links link html output
* @return string
*/
function prefix_move_category_count( $links ) {
@blainerobison
blainerobison / gist:16220392bdd29d8ee634
Created January 30, 2015 14:30
wp: Order get_terms() Numerically [WordPress]
/**
* Order get_terms() by number
*
* @param string $orderby ORDERBY clause of the terms query.
* @param array $args An array of terms query arguments.
* @param string|array $taxonomies A taxonomy or array of taxonomies.
* @return string
*/
function prefix_get_terms_orderby_numeric( $orderby, $args, $taxonomies ) {
@blainerobison
blainerobison / SassMeister-input.scss
Created February 9, 2015 18:54
Generated by SassMeister.com.
// ----
// Sass (v3.4.11)
// Compass (v1.0.3)
// ----
// Your Example
#id > .element {
#{selector-unify(&, div)} {
color: blue;
}
@blainerobison
blainerobison / gist:552e49abec345d431dd3
Created March 11, 2015 00:32
Custom Upload Directories
/**
* Add custom directory filter
*
* 'ev_custom_upload_directory'
*/
function ev_pre_upload( $file ) {
add_filter( 'upload_dir', 'ev_custom_upload_directory' );
return $file;
}
@blainerobison
blainerobison / gist:cc8b06dd2a04a5818edd
Created July 2, 2015 23:01
Remove Meta Boxes - WordPress
/**
* Remove meta boxes
*
* @return void
*/
function prefix_remove_meta_boxes() {
/* Publish meta box. */
remove_meta_box( 'submitdiv', 'post', 'normal' );
<?php
/**
* Hide Editor
*/
function prefix_hide_editor() {
// get post id
if ( isset( $_GET['post'] ) ) :
$post_id = $_GET['post'];
@blainerobison
blainerobison / .php
Last active September 21, 2024 21:01
Import Categories and Tags Into WordPress Post. Plugin: WP All Import
<?php
/**
* Import Categories and Tags Into Post
*
* Using WP CSV to export blog posts, taxonomy fields include slug (e.g. term:Term, another-term:Another Term)
* This will exclude slug, returning only term's name
*
* Example Usage: [prefix_import_term_name({tx_category[1]})]
* [prefix_import_term_name({tx_post_tag[1]})]
*
@blainerobison
blainerobison / functions.php
Created August 7, 2015 20:02
Disable Emoji output in WordPress.
<?php
/**
* Disable Emojis
*
* WordPress 4.2 introduced emoji JS and CSS in the page's head
*/
function prefix_disable_emoji() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
@blainerobison
blainerobison / setup.php
Created August 18, 2015 21:53
WordPress X-UA-Compatible Headers for IE
/**
* Set X-UA-Compatible for IE
*
* Sends headers to browser in an attempt to have IE render the website using
* their latest rendering engine (i.e. IE=edge). Additionally, attempts to
* activate Chrome Frame add-on if it exists.
*
* IE browser may show compatibility icon in address bar when using HTML5 Boilerplate's
* heading markup which contains conditional comments on HTML tag.
*
@blainerobison
blainerobison / functions.php
Created October 8, 2015 17:57
Add Featured Image Description in WordPress
<?php
/**
* Add Featured Image Description
*
* @param string $content Admin post thumbnail HTML markup.
* @param integer $content Post ID.
* @return string
*/
function prefix_featured_image_description( $content, $post_id ) {