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 is so easy, it's embarassing that I took 20 minutes to find it. | |
// "Catalog" is a custom taxonomy. | |
function make_catalog_sortable( $sortables ) { | |
$sortables[] = 'catalog'; | |
return $sortables; | |
} | |
add_filter( 'woocommerce_sortable_taxonomies', 'make_catalog_sortable' ); |
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 | |
/* | |
Takes a term from many input types: object, id, slug, name | |
Returns one of many outputs: WP_Term (object), id (int), slug, name, or any WP_Term property | |
Example Inputs: | |
smart_term_convert( 390, 'category', 'id' ); // Returns 390 | |
smart_term_convert( 'test-category', 'category', 'id' ); // Returns 390 | |
smart_term_convert( 'Test Category', 'category', 'id' ); // Returns 390 |
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 | |
/** | |
* Example Usage | |
*/ | |
$url = 'http://example.org/'; | |
$vars = array( | |
'name' => 'Radley', | |
'awesome' => 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
<?php | |
/* | |
YARPP Template: Image Previews | |
Description: Four columns of posts, each with a photo. | |
Author: radgh (RadleyGH@gmail.com) | |
*/ | |
// Put your placeholder image ID here, from the media tab in the dashboard, or leave it false to disable. | |
$placeholder_media_id = false; |
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 uploads from a local file path. | |
* To upload from a URL instead | |
* @see: https://gist.github.com/RadGH/966f8c756c5e142a5f489e86e751eacb | |
* | |
* Example usage: Upload photo from file, display the attachment as as html <img> | |
* $attachment_id = rs_upload_from_path( "/images/photo.png" ); | |
* echo wp_get_attachment_image( $attachment_id, 'large' ); |
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 | |
global $product; | |
if ( !isset($product) ) return; | |
if ( !method_exists( $product, 'get_attributes' ) ) return; // Doesn't support attributes, won't have a dropdown | |
$attributes = $product->get_attributes(); | |
// Note: <form> is just so this section is styled like the default variation dropdown The form isn't meant to do anything. | |
?> | |
<form class="cart" method="post" enctype='multipart/form-data' data-product_id="<?php echo $product->id; ?>"> |
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 video_get_service( $video_url ) { | |
if ( stristr( $video_url, 'vimeo.com') ) { | |
return 'vimeo'; | |
} | |
if ( stristr( $video_url, 'youtube.com' ) || stristr( $video_url, 'youtu.be' ) ) { | |
return 'youtube'; | |
} |
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 | |
global $acf_recalc_settings; | |
// IMPORTANT: Customize these settings for your website. | |
$acf_recalc_settings = array( | |
// How many updates to do each page load. As of November 2018, Google's GeoLocation API limit is 100 per second. | |
'posts_per_run' => 16, | |
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 | |
// Set up a webhook for your Bitbucket repo (or other service) that will visit this script (eg, http://example.org/git-pull.php). | |
// When you commit, Bitbucket will visit that URL. | |
// Now the script below runs, which will then pull from the bitbucket repo, grabbing the recently uploaded commit. | |
// All you have to do is push to Bitbucket! | |
// NOTE: This script relies on shell_exec and may not work on shared hosts. | |
$LOCAL_REPO = "/ABSOLUTE/PATH/TO/LOCAL/GIT/REPO/"; |
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
{ | |
"kind": "metapackage", | |
"abstract": "A list of modules installed on the default KSP instance", | |
"name": "installed-default", | |
"license": "unknown", | |
"version": "2015.10.23.04.07.26", | |
"identifier": "installed-default", | |
"spec_version": "v1.6", | |
"depends": [ | |
{ |