Skip to content

Instantly share code, notes, and snippets.

View crstauf's full-sized avatar
🤔
const THINKING = true;

Caleb Stauffer crstauf

🤔
const THINKING = true;
View GitHub Profile
@crstauf
crstauf / gist:5750836
Last active December 18, 2015 08:00 — forked from anonymous/gist:5750810
<?php
/**
* I want to get this query to also desplay events that are on the current day.
* Any Ideas on how I can do that?
* I added '>=' instead of '>' but it did not do anything.
* I assume time() does not work when comparing to date becuase the date starts at 0:00, so anytime on the current day will be past 0:00
*/
$args = array(
'post_type' => 'event',
function trash_past_events() {
$args = array(
'post_type' => 'event',
'posts_per_page' => -1,
'meta_key' => '_date',
'meta_value' => time(),
'meta_compare' => '<'
);
$events = new WP_Query($args);
if ($events->have_posts()) {
@crstauf
crstauf / class.image-tag.php
Last active March 24, 2023 21:55
A PHP class used to generate an <img> tag, specifically for use within WordPress sites (uploaded images, theme images, and external images) and the awesome lazysizes script (but not necessary).
<?php
/**
* Classes for image tag elements.
*
* @version 0.0.7.0
* @link https://gist.github.com/crstauf/030df6bd6c436620e96cb92a44c9772f
*/
if ( !defined( 'ABSPATH' ) || !function_exists( 'add_filter' ) ) {
header( 'Status: 403 Forbidden' );
@crstauf
crstauf / test-QM-deprecated-notices.php
Last active July 30, 2016 07:26
mu-plugin used to confirm number of notices Query Monitor receives regarding deprecated function
add_action('init','stop_heartbeat',0);
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}
foreach (array(
'muplugins_loaded',
'registered_taxonomy',
'registered_post_type',
'plugins_loaded',
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
<?php
new enhance_wp_enqueues;
class enhance_wp_enqueues {
const VERSION = '0.0.2.3';
function __construct() {
add_filter( 'style_loader_tag', array( __CLASS__, 'filter_style_loader_tag' ), 9999999, 4 );
<?php
// CSS LLC emergency.php
// version 1.0.0
define('WP_DEBUG', true);
define('SECONDS_TO_EXPIRE',180);
define('EXPIRES_AT',filemtime(__FILE__) + SECONDS_TO_EXPIRE);
$files = array('wp-blog-header.php', 'wp-admin/includes/template.php', 'wp-admin/includes/user.php');
function get_theme_asset_uri( $theme_file_path ) {
// https://gist.github.com/crstauf/22f8c1c19d614f1858bffb67dab3f73f, v2.1
if ( false === stripos( $theme_file_path, '.min.' ) )
return trailingslashit( get_stylesheet_directory_uri() ) . $theme_file_path;
$debug = SCRIPT_DEBUG;
if ( false === SCRIPT_DEBUG ) {
if ( false !== strpos( $theme_file_path, '.js' ) )
<?php
if (is_admin())
new more_post_thumbnails;
class more_post_thumbnails {
CONST version = '0.0.1';
CONST github = '';
new gravityforms_api_integration;
add_filter( 'gform_entry_meta', array( 'gravityforms_api_integration', 'filter_gform_entry_meta' ), 1, 2 );
class gravityforms_api_integration {
const gravityforms_api_integration_version = '0.0.1'; // https://gist.github.com/crstauf/9d63194eb6fd169b110b6301e8519ff3
const gforms_version = '1.9.18'; // Gravity Forms Version
const service_name = '';