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 | |
/* Merge multiple RSS feeds with SimplePie | |
* | |
* Just modify the path to SimplePie and | |
* modify the $feeds array with the feeds you want | |
* | |
* You should probably also change the channel title, link and description, | |
* plus I added a CC license you may not want | |
* | |
* Help from: http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/ |
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
// selectorSupported lovingly lifted from the mad italian genius, diego perini | |
// http://javascript.nwbox.com/CSSSupport/ | |
function selectorSupported(selector){ | |
var support, link, sheet, doc = document, | |
root = doc.documentElement, | |
head = root.getElementsByTagName('head')[0], | |
impl = doc.implementation || { |
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
require "open3" | |
def readfile(file) | |
f = File.open(file) | |
lines = f.readlines("\n\n\n\n") | |
lines.each do |line| | |
fields = line.scan(/\s+Date:\s([^\n]+)$\s+Topic:\s([^\n]+)\n(.*)/m) | |
date = fields[0][0].strip |
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
/* Extend the Underscore object with the following methods */ | |
// Rate limit ensures a function is never called more than every [rate]ms | |
// Unlike underscore's _.throttle function, function calls are queued so that | |
// requests are never lost and simply deferred until some other time | |
// | |
// Parameters | |
// * func - function to rate limit | |
// * rate - minimum time to wait between function calls | |
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request |
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 | |
/* | |
This function assumes a custom field named 'expiration' with a human friendly date/time. | |
*/ | |
function is_post_expired($post_ID = null){ | |
if(!$post_ID) global $post; | |
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 | |
/** | |
* JSON Response | |
* Get json data from url and decode. | |
*/ | |
# Get the WordPress json parser | |
if ( ! function_exists( 'json_parser' ) ) : | |
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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
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: Filename-based cache busting | |
* Version: 0.3 | |
* Description: Filename-based cache busting for WordPress scripts/styles. | |
* Author: Dominik Schilling | |
* Author URI: https://dominikschilling.de/ | |
* Plugin URI: https://gist.github.com/ocean90/1966227/ | |
* | |
* License: GPLv2 or later |
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
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
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 | |
if ( is_singular('product') ) { | |
global $post; | |
// get categories | |
$terms = wp_get_post_terms( $post->ID, 'product_cat' ); | |
foreach ( $terms as $term ) $cats_array[] = $term->term_id; |
OlderNewer