This file contains hidden or 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 | |
| // Register Custom Post Type | |
| // Note: Using woocommerce_after_register_taxonomy hook instead of init because we're using a product attribute taxonomy with this CPT | |
| function doublee_cpt_case_study() { | |
| $labels = array( | |
| 'name' => _x('Case studies', 'Post Type General Name', 'doubleedesign'), | |
| 'singular_name' => _x('Case study', 'Post Type Singular Name', 'doubleedesign'), | |
| 'menu_name' => __('Case studies', 'doubleedesign'), | |
| 'name_admin_bar' => __('Case study', 'doubleedesign'), |
This file contains hidden or 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 doublee_log_all_actions() { | |
| foreach($GLOBALS['wp_actions'] as $action => $count) { | |
| error_log(print_r($action, true)); | |
| } | |
| } | |
| add_action('shutdown', 'doublee_log_all_actions'); |
This file contains hidden or 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 role drop-down to orders screen | |
| */ | |
| function doublee_add_order_user_role_filter_selectbox() { | |
| global $typenow, $wp_query; | |
| if (in_array($typenow, wc_get_order_types('order-meta-boxes'))) : | |
| $user_role = ''; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) { |