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 | |
| /** | |
| * Callback function for taxonomy meta boxes | |
| * | |
| * A simple callback function for 'meta_box_cb' argument | |
| * inside register_taxonomy() that replaces the regular | |
| * checkboxes with a plain dropdown list | |
| * | |
| * @param [type] $post [description] | |
| * @param [type] $box [description] |
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 | |
| // Converts a number into a short version, eg: 1000 -> 1k | |
| // Based on: http://stackoverflow.com/a/4371114 | |
| function number_format_short( $n, $precision = 1 ) { | |
| if ($n < 900) { | |
| // 0 - 900 | |
| $n_format = number_format($n, $precision); | |
| $suffix = ''; | |
| } else if ($n < 900000) { |
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 | |
| /** | |
| * Retrieves an image from a URL and uploads it using ld_handle_upload_from_path. See that function for more details. | |
| * | |
| * Note: This function should also work for local file paths as well, but the implementation is slightly different than ld_handle_upload_from_path. | |
| * | |
| * @param $image_url | |
| * @param int $attach_to_post | |
| * @param bool|true $add_to_media |
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 | |
| /* | |
| Plugin Name: Homestead Apothecary - Role Based Shipping and Checkout | |
| Plugin URI: http://alchemyandaim.com/ | |
| Description: Customizes the availability of shipping methods and checkout gateways based on user role. No settings are available for this plugin, customizations must be made to the plugin directly. | |
| Author: Alchemy + Aim | |
| Author URI: https://alchemyandaim.com/ | |
| */ | |
| define( 'HA_RBSC_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); |
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: http://wordpress.stackexchange.com/questions/42652/#answer-42729 | |
| These functions provide a simple way to interact with TinyMCE (wp_editor) visual editor. | |
| This is the same thing that WordPress does, but a tad more intuitive. | |
| Additionally, this works for any editor - not just the "content" editor. | |
| Usage: |
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
| $(document).ready(function(){ | |
| $(".monthPicker").datepicker({ | |
| dateFormat: 'mm-yy', | |
| changeMonth: true, | |
| changeYear: true, | |
| showButtonPanel: true, | |
| onClose: function(dateText, inst) { | |
| var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val(); |
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
| git reset --hard | |
| git clean -f -d | |
| Description: | |
| ============ | |
| Git Tips: Remove untracked files and directories from the working | |
| tree when switching branches or checking out different commits. | |
| Explanation: |
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 | |
| /** | |
| * Compare two arrays and return a list of items only in array1 (deletions) and only in array2 (insertions) | |
| * | |
| * @param array $array1 The 'original' array, for comparison. Items that exist here only are considered to be deleted (deletions). | |
| * @param array $array2 The 'new' array. Items that exist here only are considered to be new items (insertions). | |
| * @param array $keysToCompare A list of array key names that should be used for comparison of arrays (ignore all other keys) | |
| * @return array[] array with keys 'insertions' and 'deletions' | |
| */ | |
| public static function arrayDifference(array $array1, array $array2, array $keysToCompare = null) { |
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
| product_add_to_cart : function(){ | |
| var ajx_data = {}; | |
| var ajx_grab = {}; | |
| $(document).on('change','.single-product .variations_form select',function(e){ | |
| var $this = $(this); | |
| var pro_id = $(".single-product .variations_form").attr('data-product_id'); | |
| var attribute_name = $this.attr('data-attribute_name'); | |
| var attribute_value = $this.val(); | |
| var post_ajxurl = window.location+"?wc-ajax=get_variation"; |