Skip to content

Instantly share code, notes, and snippets.

View daltonrooney's full-sized avatar

Dalton Rooney daltonrooney

View GitHub Profile
@cubehouse
cubehouse / gist:3839159
Created October 5, 2012 10:34
WordPress Fake Page Generator - Use in Theme/Plugin to create non-existant pages dynamically
// create fake page called "chat-room"
// modify function and variable names with "ABCD" to whatever you like
// modify variable $fakepage_ABCD_url to the fake URL you require
add_filter('the_posts','fakepage_ABCD_detect',-10);
function fakepage_ABCD_detect($posts){
global $wp;
global $wp_query;
global $fakepage_ABCD_detect; // used to stop double loading
@papucho
papucho / file.html
Created April 18, 2013 20:59
Grayscale filter using SVG+CSS
<img src="http://lorempixel.com/400/200/sports/" alt="" class="fader">
@thenbrent
thenbrent / woocommerce-disable-paypal-for-subscriptions.md
Last active October 31, 2016 20:17
Using WooCommerce and want to disable PayPal for subscription purchases, but still offer it as an option for buying one-off products? Activate this plugin.

This gist has been migrated to a repo here.

@zulfajuniadi
zulfajuniadi / .htaccess
Created December 25, 2013 16:02
Enable CORS via htaccess.
Header add Content-Type "application/json"
Header add Access-Control-Allow-Methods "GET,HEAD,POST,PUT,DELETE,OPTIONS"
Header add Access-Control-Allow-Headers "Auth-Token,Content-Type"
Header add Access-Control-Allow-Origin "*"
@miguel-perez
miguel-perez / readyExec.js
Last active January 29, 2023 18:04
How to add the ability to re-run $(document).ready() functions
/**
* Replace jQuery's $.fn.ready() function with a mod exec
*
* Sites that make heavy use of the $(document).ready function
* are generally incompatable with asynchrounous content. The
* the $.fn.ready function only runs once. This script replaces
* the ready function with a module execution controller that
* let's us register functions and execute all of the functions
* as we need them. This is useful after HTML gets injected on the
* page and we want to rebind functionally to the new content.
@davidhund
davidhund / feature-detect flexbox.js
Last active October 17, 2019 16:02
The simplest feature-detect for flexbox?
/*
* Trying to feature-detect (very naive)
* CSS Flexbox support.
* - Only most modern syntax
*
* Is this nonsense?
*/
(function NaiveFlexBoxSupport(d){
var f = "flex", e = d.createElement('b');
// Hover.com "Zone file import/export" has been *Planned* since 2011
// https://help.hover.com/entries/471066-Zone-file-import-export
// Here's a brittle approximation of export.
//
// 1. login to your account: https://www.hover.com/domains
// 2. run the following in your browser's JavaScript console, changing the first line
// to your domain
// 3. copy the text logged to the console.
// 4. manually correct FQDNs, these have to end with a period "."
//
@Stoffo
Stoffo / twig_file_date_extension.php
Last active May 24, 2020 07:47
Twig Function to get the file mtime in template for HTTP Caching
<?php
$function_filedate = new Twig_SimpleFunction(
'fileDate',
/**
* @param $file_path
* This function generates a new file path with the last date of filechange
* to support better better client caching via Expires header:
* i.e:
@mgibbs189
mgibbs189 / test.js
Created March 22, 2016 17:08
Show template after initial interaction
<script>
(function($) {
$(function() {
$(document).on('facetwp-loaded', function() {
if (FWP.loaded) { // after initial pageload
$('.facetwp-template').show();
}
});
});
})(jQuery);
add_filter('the_title', 'filterNestedPagesTitles', 10, 3);
function filterNestedPagesTitles($title, $post_id, $view = false)
{
if ( !is_admin() ) return $title;
$screen = get_current_screen();
if ( $screen->base != 'toplevel_page_nestedpages' ) return $title;
if ( !isset($view) || $view != 'nestedpages_title' ) return $title;
// Code to configure custom title here
$title = 'Custom Title';
return $title;