Skip to content

Instantly share code, notes, and snippets.

Weston Ruter westonruter

Block or report user

Report or block westonruter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View functions.php
<?php
/**
* Plugin Name: WPSE 282139
* Plugin URI: https://wordpress.stackexchange.com/questions/282139/how-to-make-get-theme-mod-work-with-ajax-in-the-customizer-preview
*/
add_action( 'wp_ajax_my_request', function () {
ob_start();
echo get_theme_mod( 'position', 'top' );
View wpse-254735.php
<?php
function my_styles_method() {
wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/custom-css.css' );
$colors = array(
'headings_color' => get_theme_mod( 'wpt_heading_color' ),
);
$css_output = "{color: {$colors['headings_color']}; }";
$selector = 'h1,h2,h3,h4,h5,h6';
View entities.show.20s.json
{
"premiereDate": "2016-08-08T16:00:00.000Z",
"votingDate": "2016-11-08T16:00:00.000Z",
"finaleDate": "2016-11-15T16:00:00.000Z",
"logo": "http://placekitten.com/200/200"
}
View multisite-network-upgrade.php
<?php
/**
* Plugin Name: Multisite Network Upgrade WP-CLI Command
* Plugin URI: https://gist.github.com/westonruter/beb6120e61e9691e88ac
* Author: Weston Ruter, Mo Jangda
* Description: From command line run <code>wp multisite-network-upgrade</code>. Script converted into WP-CLI command from Mo's <a href="https://gist.github.com/mjangda/986838">CLI script</a>.
* License: GPL2
*/
if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {
@westonruter
westonruter / gist:5475349
Last active Feb 6, 2017 — forked from markjaquith/gist:2653957
WordPress Fragment Caching convenience wrapper
View gist:5475349
<?php
/*
Usage:
cache_fragment_output( 'unique-key', 3600, function () {
functions_that_do_stuff_live();
these_should_echo();
});
*/
function cache_fragment_output( $key, $ttl, $function ) {
View jquery.ba-bindandtrigger.js
/*!
* bindAndTrigger - v0.2 - 04/30/2010
* http://benalman.com/ (original v0.1 at http://gist.github.com/384866 )
* http://weston.ruter.net/ (playing around with improving variable args)
*
* http://jsfiddle.net/cowboy/fJnA2/
*/
(function($,undefined){
You can’t perform that action at this time.