Skip to content

Instantly share code, notes, and snippets.

View DrizzlyOwl's full-sized avatar

Ash Davies DrizzlyOwl

View GitHub Profile
+--------------+--------------------+--------------------+-------------+--------+---------------------+
| language | english_name | native_name | status | update | updated |
+--------------+--------------------+--------------------+-------------+--------+---------------------+
| ar | Arabic | العربية | uninstalled | none | 2015-08-18 00:32:07 |
| ary | Moroccan Arabic | العربية المغربية | uninstalled | none | 2015-10-27 20:45:33 |
| az | Azerbaijani | Azərbaycan dili | uninstalled | none | 2015-09-22 14:16:17 |
| bg_BG | Bulgarian | Български | uninstalled | none | 2015-10-25 14:32:58 |
| bn_BD | Bengali | বাংলা | uninstalled | none | 2015-09-16 05:09:40 |
| bs_BA | Bosnian | Bosanski | uninstalled | none | 2015-08-18 21:20:44 |
@DrizzlyOwl
DrizzlyOwl / functions.php
Created December 2, 2015 10:41
Search query
<?php
// ---- //
function do_search(){
global $wpdb;
if(isset($wpdb)):
// assign all variables from our get data
$filter_year = isset($_GET['pub_year']) ? $_GET['pub_year'] : '';
@DrizzlyOwl
DrizzlyOwl / functions.php
Created December 7, 2015 11:46 — forked from anonymous/functions.php
Safely force WordPress to 404
<?php
// safe 404
// Force WordPress to 404 on the current template
// SEO Friendly!
// =================================================
function safe_404(){
global $wp_query;
$wp_query->set_404();
status_header(404);
@DrizzlyOwl
DrizzlyOwl / gmap.js
Last active January 5, 2016 09:14
Google map + geocode api to dynamically create a map using a provided address
!function(e,t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd&&define("GMaps",[],t),e.GMaps=t()}(this,function(){if("object"!=typeof window.google||!window.google.maps)throw"Google Maps API is required. Please register the following JavaScript library http://maps.google.com/maps/api/js?sensor=true.";var t=function(e,t){var o;if(e===t)return e;for(o in t)e[o]=t[o];return e},o=function(e,t){var o,n=Array.prototype.slice.call(arguments,2),r=[],s=e.length;if(Array.prototype.map&&e.map===Array.prototype.map)r=Array.prototype.map.call(e,function(e){return callback_params=n,callback_params.splice(0,0,e),t.apply(this,callback_params)});else for(o=0;s>o;o++)callback_params=n,callback_params.splice(0,0,e[o]),r.push(t.apply(this,callback_params));return r},n=function(e){var t,o=[];for(t=0;t<e.length;t++)o=o.concat(e[t]);return o},r=function(e,t){var o=e[0],n=e[1];return t&&(o=e[1],n=e[0]),new google.maps.LatLng(o,n)},s=function(e,t){var o;for(o=0;o<e.length;o++)e[o]instanceof google.ma
@DrizzlyOwl
DrizzlyOwl / search.php
Last active February 17, 2016 15:07
WordPress Search template
<?php
// Get the header
get_header();
// Results pagination offset
$offset = ($_GET["offset"] ? $_GET["offset"] : 0);
// load the global query ++ the global searched keyword
global $wp_query, $s;
@DrizzlyOwl
DrizzlyOwl / template.php
Last active March 18, 2016 09:52
WordPress pagination snippet
<?php
// Get the header
get_header();
// Results pagination offset
$offset = ($_GET["offset"] ? $_GET["offset"] : 0);
global $wp_query;
$found_posts = $wp_query->found_posts;
@DrizzlyOwl
DrizzlyOwl / functions.php
Created May 25, 2016 11:22
WordPress protected page template
<?php
/**
* Load a different template if a user without 'contributor' permissions lands on a page which uses the
* tpl-protected.php template
*
* @param $template
* @return string
*/
function filter_protected_page( $template ) {
global $post;
@DrizzlyOwl
DrizzlyOwl / functions.php
Created September 29, 2016 13:17 — forked from wpscholar/functions.php
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/
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure