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 | |
/** | |
* Customise oembed fetching to pass arguments through to alternate services | |
*/ | |
add_filter('oembed_fetch_url', function($provider, $url, $args) { | |
if (strpos($provider, 'vimeo.com') !== false) { | |
if (isset($args['autoplay'])) { | |
$provider = add_query_arg('autoplay', absint($args['autoplay']), $provider); | |
} |
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 | |
/** | |
* A walker class for specific navigation menus in your theme, where you'd like to be | |
* able to show your WooCommerce basket total | |
* | |
* @package YOUR_THEME | |
* @since 1.0.0 | |
*/ | |
if (!class_exists('Theme_WC_Nav_Menu')) { | |
class Theme_WC_Nav_Menu extends Walker_Nav_Menu { |
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 | |
$dropdown_taxonomy = 'YOUR_TAXONOMY_NAME'; | |
$dropdown_terms = get_terms($dropdown_taxonomy); | |
$archive_url = home_url('/'); // change this to the URL the user should go to if they select "All" | |
if (!empty($dropdown_terms)) : | |
?> | |
<select id="term-dropdown" class="term-dropdown"> | |
<option value="<?php echo $archive_url; ?>">All</option> | |
<?php foreach ($dropdown_terms as $dropdown_term) : ?> |
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 | |
/** | |
* is_nth_level_page | |
* | |
* Quick, small function to check if your page is currently the nth child | |
* | |
* @param int $n The page level you want to check for | |
* @param int $page_id (optional) The ID of the page to check | |
* | |
* @return boolean |
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 | |
/** | |
* time_elapsed_string() | |
* | |
* @author Zachary Johnson | |
* @link http://www.zachstronaut.com/posts/2009/01/20/php-relative-date-time-string.html | |
* | |
* @author Vyygir | |
* @link https://gist.github.com/Vyygir/5a70d8007141cf49541b967c8e9a2280 | |
* @description I had to modify this slightly from the previous version, as it was causing errors |
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_action('wp', 'handle_all_file_downloads'); | |
function handle_all_file_downloads() { | |
if (isset($_GET) && isset($_GET['download'])) { | |
$urls = base64_decode($_GET['download']); | |
if ($urls) { | |
$urls = (strpos($urls, ';') !== false) ? explode(';', $urls) : array($urls); | |
$path = wp_upload_dir(); | |
$zip = new ZipArchive(); |
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
### OS X ### | |
*.DS_Store | |
.AppleDouble | |
.LSOverride | |
Icon | |
._* | |
.DocumentRevisions-V100 | |
.fseventsd | |
.Spotlight-V100 | |
.TemporaryItems |
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
function preloadImages() { | |
var buffer, images; | |
buffer = new Image(); | |
images = document.getElementsByTagName('img'); | |
if (images.length) { | |
for (var i = 0, l = images.length; i < l; i++) { | |
buffer.src = images[i].src; | |
} |
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 | |
/** | |
* A class to enable easier generation of sharing links per service, rather than | |
* having to hard-code them in templates | |
**/ | |
global $sharing_links; | |
class Sharing_Links { | |
private $title; | |
private $link; |