Ensure Webfont is Loaded (non-Elementor)
function custom_font_display( $current_value, $font_family, $data ) { return ‘swap’; } add_filter( ‘font_display’, ‘custom_font_display’, 10, 3 );Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
function custom_font_display( $current_value, $font_family, $data ) { return ‘swap’; } add_filter( ‘font_display’, ‘custom_font_display’, 10, 3 );Continue reading
add_filter( ‘elementor_pro/custom_fonts/font_display’, function( $current_value, $font_family, $data ) { return ‘swap’; }, 10, 3 );Continue reading
/** * We will Dequeue the jQuery UI script as example. * * Hooked to the wp_print_scripts action, with a late priority (99), * so that it is after the script was enqueued. */ function wp_remove_scripts() { // check if…Continue reading
add_filter( ‘the_content’, ‘add_image_dimensions’ ); function add_image_dimensions( $content ) { preg_match_all( ‘/]+>/i’, $content, $images); if (count($images) < 1) return $content; foreach ($images[0] as $image) { preg_match_all( '/(alt|title|src|width|class|id|height)=("[^"]*")/i', $image, $img ); if ( !in_array( 'src', $img[1] ) ) continue; if ( !in_array(…Continue reading
//Remove Gutenberg Block Library CSS from loading on the frontend function smartwp_remove_wp_block_library_css(){ wp_dequeue_style( ‘wp-block-library’ ); wp_dequeue_style( ‘wp-block-library-theme’ ); } add_action( ‘wp_enqueue_scripts’, ‘smartwp_remove_wp_block_library_css’ );Continue reading
function g9_upcoming_events($atts) { $shortcode_args = shortcode_atts(array( ‘number’ => 3, // Number of events ‘category’ => ”, // Category slug ‘slider’ => false, ), $atts); // Ensure the global $post variable is in scope global $post; // Retrieve the next 3…Continue reading
remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_product_data_tabs’, 10 ); function g9_woocommerce_template_product_description() { woocommerce_get_template( ‘single-product/tabs/description.php’ ); } add_action( ‘woocommerce_after_single_product_summary’, ‘g9_woocommerce_template_product_description’, 20 );Continue reading
function g9_remove_order_notes( $fields ) { unset($fields[‘order’][‘order_comments’]); return $fields; } add_filter( ‘woocommerce_checkout_fields’ , ‘g9_remove_order_notes’ );Continue reading
function g9_add_percentage_to_sale_badge($html, $post, $product) { global $product; $stock = $product->get_stock_status(); $product_type = $product->get_type(); $sale_price = 0; $regular_price = 0; if ($product_type == ‘variable’) { $product_variations = $product->get_available_variations(); foreach ($product_variations as $kay => $value) { if ($value[‘display_price’] < $value['display_regular_price']) { $sale_price…Continue reading
remove_action(‘woocommerce_before_shop_loop’, ‘woocommerce_catalog_ordering’, 30); remove_action(‘woocommerce_before_shop_loop’, ‘woocommerce_result_count’, 20); remove_action(‘woocommerce_after_shop_loop’, ‘woocommerce_result_count’, 20);Continue reading