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 | |
/** | |
* Product Categories Widget | |
* Modifies the WooCommerce product categories widget to display as a Bootstrap accordion. | |
* | |
* @package WooCommerce/Widgets | |
* @version 2.3.0 | |
*/ | |
defined( 'ABSPATH' ) || exit; |
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 | |
/** | |
* Utility function to create a zip file from an array of file URLs | |
* Used for download links in emails | |
* @param array $files | |
* @param string $filename | |
* | |
* @return string | |
*/ | |
function doublee_zip_order_files(array $files, string $filename) { |
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 | |
/** | |
* The SEO Framework + ACF flexible content integration | |
* TSF will look at the excerpt and then the content to generate the default meta description. | |
* If both of those are empty, this code looks for ACF flexible modules to get it from. | |
* // TODO: Make this work with archives as well as posts | |
* @param $description | |
* @param $args | |
* | |
* @return mixed|string |
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 to export the orders list to a CSV download (not stored anywhere) | |
* CSV construction based on https://gist.github.com/vrushank-snippets/4274500 | |
* Dev notes: | |
* - This file is designed to be called via AJAX, with that function providing the order IDs. | |
* - To use this without AJAX you would just need to define $order_ids = wp_list_pluck($wp_query->posts, 'ID') instead, | |
* and define $filename as something appropriate here. | |
*/ | |
function doublee_export_orders() { |
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 custom columns in Users area in the CMS | |
* @param $columns | |
* | |
* @return mixed | |
*/ | |
function doublee_manage_users_columns($columns) { | |
$columns['join_date'] = 'Join date'; |
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 base tier option to Advanced tab of subscription product | |
*/ | |
function doublee_subscription_product_advanced_settings() { | |
$product = wc_get_product(get_the_id()); | |
if($product->get_type() === 'variable-subscription') { | |
$variations = $product->get_available_variations(); | |
$variation_options = array(); | |
foreach ($variations as $variation) { |
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
// Note: This assumes you already have the CSS set up for the classes you want to use. | |
function initCarousel() { | |
$('.my-carousel').slick({ | |
slidesToShow: 1, | |
slidesToScroll: 1, | |
autoplay: false, | |
adaptiveHeight: false, | |
fade: true, |
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 | |
/** | |
* Archive filter queries using the drop-downs on each archive | |
* | |
* @see filters.php | |
* @param $query | |
*/ | |
function wh_filter_archives($query) { | |
// Do not modify queries in the admin |
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 reCaptcha to checkout form | |
* Note: Can't place within the payment part of the form, WooCommerce just won't show it, choose an appropriate action to add it to accordingly | |
* @param $checkout | |
*/ | |
function doublee_show_me_the_checkout_captcha($checkout) { | |
echo '<div class="g-recaptcha" data-sitekey="YOUR_KEY_HERE"></div>'; | |
} | |
add_action('woocommerce_checkout_order_review', 'doublee_show_me_the_checkout_captcha', 18); |