This gist has been migrated to a repo here.
This file contains 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
{# ================================================================== #} | |
{# Responsive Image Macro | |
{# ================================================================== #} | |
{# | |
Macro to centralize the markup and config for responsive images. | |
Based on an article by Marion Newlevant (@marionnewlevant) and | |
adapted for the Lazysizes plugin. Read more: | |
https://straightupcraft.com/articles/responsive-images-with-twig-macros |
This file contains 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 | |
/* | |
* Plugin Name: Remove HTML | |
* Description: batch Remove HTML from post_content | |
* Author: Marc Gratch | |
* Author URI: http://marcgratch.com | |
* Version: 0.1.0 | |
*/ | |
function rh_get_all_ids(){ | |
$args = array ('post_type' => array('post','page'), 'fields' => 'ids', 'posts_per_page' => -1); |
This file contains 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
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; |
This file contains 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
<script> | |
(function($) { | |
$(function() { | |
$(document).on('facetwp-loaded', function() { | |
if (FWP.loaded) { // after initial pageload | |
$('.facetwp-template').show(); | |
} | |
}); | |
}); | |
})(jQuery); |
This file contains 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_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: |
This file contains 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
// 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 "." | |
// |
This file contains 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
/* | |
* 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'); |
This file contains 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
/** | |
* 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. |
This file contains 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
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 "*" |
NewerOlder