Skip to content

Instantly share code, notes, and snippets.

View trishasalas's full-sized avatar

Trisha Salas trishasalas

  • Level Access
  • Tulsa, OK
View GitHub Profile
@petenelson
petenelson / gga-set-featured-image-from-url.php
Created February 5, 2014 16:01
WordPress: Download and set featured image for a post from a URL
@mattheu
mattheu / CMB-field.linklist.js
Last active May 24, 2016 09:04
A custom CMB field type for some flexible content
@lloc
lloc / gist:5685040
Last active July 14, 2016 02:59
WordPress - Add link to plugin_row_meta
<?php
define( 'PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
function my_plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
if ( PLUGIN_BASENAME == $plugin_file )
$plugin_meta[] = '<a href="#">Test: plugin_row_meta</a>';
return $plugin_meta;
}
add_filter( 'plugin_row_meta', 'my_plugin_row_meta', 10, 4 );
@pippinsplugins
pippinsplugins / gist:146c6f90bc8194c7dba1
Last active May 9, 2017 23:13
This is a simple example that shows how we can maintain backwards compatibility in a plugin for data that used to be stored in post meta but is now stored in a taxonomy term. When this change was made, a new `edd_get_commission_status()` function was introduced, but before this function existed, the status was retrieved by calling `get_post_meta…
<?php
/**
* Filters get_post_meta() to ensure old commission status checks don't fail
*
* The status for commission records used to be stored in postmeta, now it's stored in a taxonomy
*
* @access private
* @since 2.8
* @return mixed
@mjsdiaz
mjsdiaz / functions.php
Last active September 8, 2017 21:25
WordPress Menu Order Sort for Adjacent Previous - Next Single Post Navigation - https://amethystwebsitedesign.com/wordpress-menu-order-sort-for-adjacent-previous-next-single-post-navigation
<?php
// Do NOT add the line above when you copy.
/** Add previous/next post navigation on book posts.
* http://snipplr.com/view/74493/adjacent-post-by-alphabetical-order-in-wordpress/
* /wp-includes/link-template.php
* line 1608
* $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms );
* line 1620
* $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );
@urre
urre / gist:44f6c6d87cc3c201122f
Created January 9, 2015 20:22
WordPress: Get posts from multisite sites (not main site)
<?php
$sites = wp_get_sites();
foreach($sites as $site) :
// Only subsites
if (!is_main_site($site['blog_id'])) :
// Connect to new multisite
@timkelty
timkelty / config.rb
Created January 11, 2012 15:28
Compass config.rb
# Note that while this file is in our config folder, it is
# symlinked to our site folders, so paths are relative from there
# Require gems and Compass plugins
# require 'rgbapng'
# require 'compass-fancybox-plugin'
require 'compass-growl'
# General
output_style = :expanded
@davatron5000
davatron5000 / icon-grid.html
Created January 14, 2015 21:27
SVG Icon Grid
<div id="styleguide-icon-grid"></div>
<object data="/assets/icons.svg" id="svgembed" height=0; width=0></object>
<script>
var grid = document.querySelector('#styleguide-icon-grid');
var tmpl = '<div class="item"><svg class="icon"><use xlink:href="/assets/icons.svg#{id}"></use></svg><span>#{id}</span></div>';
function svgloaded() {
var svgEmbed = document.querySelector("#svgembed");
var svg = svgEmbed.getSVGDocument();
@wpscholar
wpscholar / functions.php
Last active March 1, 2021 13:26
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@helen
helen / wp-chosen-tax-metabox.php
Last active April 24, 2022 02:25
Use Chosen for a replacement WordPress taxonomy metabox
<?php
/**
* WordPress Chosen Taxonomy Metabox
* Author: Helen Hou-Sandi
*
* Use Chosen for a replacement taxonomy metabox in WordPress
* Useful for taxonomies that aren't changed much on the fly and are
* non-hierarchical in nature, as Chosen is for flat selection only.
* You can always use the taxonomy admin screen to add/edit taxonomy terms.
* Categories need slightly different treatment from the rest in order to