Limit WooCommerce Order Note Length

function g9_limit_order_note_length($fields) { $fields[‘order’][‘order_comments’][‘maxlength’] = 200; return $fields; } add_filter(‘woocommerce_checkout_fields’, ‘g9_limit_order_note_length’);Continue reading

Only Allow SVG Files for Administrators

function wpsnippets_allow_svg_files($mime_types) { // Return original value if user doesn’t have a required capability if (!current_user_can(‘manage_options’)) { return $mime_types; } $mime_types[‘svg’] = ‘image/svg+xml’; $mime_types[‘svgz’] = ‘image/svg+xml’; return $mime_types; } add_filter(‘upload_mimes’, ‘wpsnippets_allow_svg_files’);Continue reading

Remove All Emoji Related Assets

function g9_disable_emojis() { remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7); remove_action(‘admin_print_scripts’, ‘print_emoji_detection_script’); remove_action(‘wp_print_styles’, ‘print_emoji_styles’); remove_action(‘admin_print_styles’, ‘print_emoji_styles’); remove_filter(‘the_content_feed’, ‘wp_staticize_emoji’); remove_filter(‘comment_text_rss’, ‘wp_staticize_emoji’); remove_filter(‘wp_mail’, ‘wp_staticize_emoji_for_email’); add_filter(‘tiny_mce_plugins’, ‘g9_disable_emojis_tinymce’); add_filter(‘wp_resource_hints’, ‘g9_disable_emoji_dns_prefetch’, 10, 2); } function g9_disable_emojis_tinymce($plugins) { if (is_array($plugins)) { return array_diff($plugins, array(‘wpemoji’)); } else { return array(); }…Continue reading

Mastercard Payment Gateway

/** * Add the gateway to WC Available Gateways * * @since 1.0.0 * @param array $gateways all available WC gateways * @return array $gateways all WC gateways + Woo MPGS gateway */ function woo_mpgs_add_to_gateways( $gateways ) { $gateways[] =…Continue reading

Allow Shortcodes in Product Excerpts

if (!function_exists(‘woocommerce_template_single_excerpt’)) { function woocommerce_template_single_excerpt($post) { global $post; if ($post->post_excerpt) echo ‘ ‘ . do_shortcode(wpautop(wptexturize($post->post_excerpt))) . ‘ ‘; } }Continue reading