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
/* Produces a dump on the state of WordPress when a not found error occurs */ | |
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */ | |
ini_set( 'error_reporting', -1 ); | |
ini_set( 'display_errors', 'On' ); | |
echo '<pre>'; | |
add_action( 'parse_request', 'debug_404_rewrite_dump' ); | |
function debug_404_rewrite_dump( &$wp ) { |
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 | |
// Add a date range to a datepicker field, replace #date with the id of the date field. | |
add_filter( 'wp_footer' , 'woo_add_checkout_field_date_range_limit' ); | |
function woo_add_checkout_field_date_range_limit() { | |
if ( is_checkout() ) { | |
$js = 'jQuery( "#date" ).datepicker({ minDate: -5, maxDate: "+1M +10D" });'; | |
// Check if WC 2.1+ | |
if ( defined( 'WC_VERSION' ) && WC_VERSION ) { | |
wc_enqueue_js( $js ); | |
} else { |
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
/** Get or set the current outer width/height for the first element in the set of matched elements. */ | |
var origOuterWidth = $.fn.outerWidth; | |
$.fn.outerWidth = function(){ | |
var value = arguments[0]; | |
if (arguments.length === 0 || typeof value === 'boolean') { return origOuterWidth.apply(this, arguments); } | |
else if (typeof value !== 'number') { throw new Error('Invalid argument. The new outerWidth value must be an integer.'); } | |
var css = ['borderLeftWidth','borderRightWidth','paddingLeft','paddingRight']; | |
if (arguments[1] === true) { css.push('marginLeft'); css.push('marginRight'); } | |
var $el = $(this), exclude = 0, parse = parseFloat; | |
for (var i=0; i<css.length; i++) { exclude += parse($el.css(css[i])); } |
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
Drupal.settings.isTouchDevice = function() { | |
return "ontouchstart" in window; | |
} | |
if ( Drupal.settings.isTouchDevice() ) { | |
Drupal.behaviors.jQueryMobileSlideShowTouchAdvance = { | |
attach: function(context, settings) { | |
self = Drupal.behaviors.jQueryMobileSlideShowTouchAdvance; | |
jQuery.each(jQuery(".views_slideshow_cycle_main.viewsSlideshowCycle-processed"), function(idx, value) { | |
value.addEventListener("touchstart", self.handleTouchStart); |
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
/** | |
* Apply a template to all subcategories of a certain parent category. | |
* | |
* Initial work by Jared Atchison. | |
* http://www.jaredatchison.com/2011/10/02/taking-advantage-of-the-template_include-filter/ | |
* | |
* Revisited by GaryJones https://gist.github.com/GaryJones/1258784 | |
* https://gist.github.com/GaryJones/1258784 | |
* | |
* An improved version of the original Jared/Gary version which checks for, in order, the presence of the templates: |
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
#!/bin/bash | |
BACKUP_DIR="~/db_backups" | |
DBUSER="" | |
DBPASSWORD="" | |
BUCKET="your-unique-bucket-name" | |
FROM='"Backups" <backups@localhost>' | |
TO='"Admin" <admin@localhost>' | |
SUBJECT='Backup Log' |