Skip to content

Instantly share code, notes, and snippets.

@krafit
krafit / geodistance.php
Created October 15, 2017 15:39 — forked from ChrisFlannagan/geodistance.php
Calculate distance between to coordinates of latitude and longitude using the WP REST API and return posts ordered by distance from user's coordinates
<?php
/**
* Heavily borrowed from: http://xplus3.net/2010/08/08/filtering-on-a-non-standard-database-field-with-wordpress/
**/
class CoordinatesTable extends DB {
protected $db_option = "coordinates_db";
@krafit
krafit / .htaccess
Created March 12, 2016 20:12 — forked from sergejmueller/.htaccess
Erweiterung der Apache-Systemdatei .htaccess für die Browser-abhängige Auslieferung von WebP- statt JPEG-Bilddateien. Speziell für WordPress. Mehr Informationen zu WebP und dem abgebildeten Snippet unter https://github.com/sergejmueller/sergejmueller.github.io/wiki/WebP:-JPEG-Nachfolger
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule ^(wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
@krafit
krafit / class-virtualthemedpage-bc.php
Created March 2, 2016 13:05 — forked from brianoz/class-virtualthemedpage-bc.php
WordPress Virtual page with theme
<?php
/*
* Virtual Themed Page class
*
* This class implements virtual pages for a plugin.
*
* It is designed to be included then called for each part of the plugin
* that wants virtual pages.
*
* It supports multiple virtual pages and content generation functions.