This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<schema name="wpdata" version="1.1"> | |
<types> | |
<!-- Geo location fields --> | |
<fieldType name="latitude_longitude" class="solr.LatLonType" subFieldSuffix="_coordinate"/> | |
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> | |
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/> | |
<fieldType name="integer" class="solr.TrieIntField" omitNorms="true"/> | |
<fieldType name="long" class="solr.TrieLongField" omitNorms="true"/> | |
<fieldType name="float" class="solr.TrieFloatField" omitNorms="true"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function action_pre_get_posts( $query ) { | |
if ( $query->is_tax() && $query->is_main_query() ) { | |
$meta_query = array( | |
array( | |
'key' => 'date', | |
'compare' => '>=', | |
'value' => date( 'Ymd' ), | |
), | |
array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function action_pre_get_posts( $query ) { | |
if ( $query->is_tax() && $query->is_main_query() ) { | |
$meta_query = array( | |
array( | |
'key' => 'date', | |
'compare' => '>=', | |
'value' => date( 'Ymd' ), | |
), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function action_pre_get_posts( $query ) { | |
if ( $query->is_tax() && $query->is_main_query() ) { | |
$meta_query = array( | |
array( | |
'key' => 'date', | |
'compare' => '>=', | |
'value' => date( 'Ymd' ), | |
), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function action_pre_get_posts( $query ) { | |
if ( $query->is_tax() && $query->is_main_query() ) { | |
$meta_query = array( | |
array( | |
'key' => 'date', | |
'compare' => '>=', | |
'value' => date( 'Ymd' ), | |
), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Replace the `ver` query arg with the file's last modified timestamp | |
* | |
* @param string $src URL to a file | |
* @return string Modified URL to a file | |
*/ | |
function filter_cache_busting_file_src( $src = '' ) { | |
global $wp_scripts; | |
// If $wp_scripts hasn't been initialized then bail. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Thing { | |
/** | |
* Get an instance of this class | |
*/ | |
static function get_instance() { | |
static $instance = null; | |
if ( null === $instance ) { | |
$instance = new static(); | |
$instance->setup_actions(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! function_exists( 'wp_dump' ) ) : | |
/** | |
* Dump variables preserving whitespace so they are easier to read. | |
*/ | |
function wp_dump() { | |
$is_xdebug = false; | |
if ( function_exists( 'xdebug_dump_superglobals' ) ) { | |
$is_xdebug = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a simple AWS Lambda function that will look for a given file on S3 and return it | |
* passing along all of the headers of the S3 file. To make this available via a URL use | |
* API Gateway with an AWS Lambda Proxy Integration. | |
* | |
* Set the S3_REGION and S3_BUCKET global parameters in AWS Lambda | |
* Make sure the Lambda function is passed an object with `{ pathParameters : { proxy: 'path/to/file.jpg' } }` set | |
*/ | |
var AWS = require('aws-sdk'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add `SQL_NO_CACHE` to every SELECT statement | |
// Helpful for debugging query performance | |
add_filter( 'query', function( $query ) { | |
$query = preg_replace( '/SELECT(\s)/i', 'SELECT SQL_NO_CACHE$1', $query, 1 ); | |
return $query; | |
}); |