Allow SVG Files Upload (copy)

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading

Disable, Add, and Enable Thumbnail Sizes – reference

// disable generated image sizes //function tps_disable_image_sizes($sizes) { //unset($sizes[‘thumbnail’]); // disable thumbnail size //unset($sizes[‘medium’]); // disable medium size //unset($sizes[‘large’]); // disable large size //unset($sizes[‘medium_large’]); // disable medium-large size //unset($sizes[‘1536×1536’]); // disable 2x medium-large size //unset($sizes[‘2048×2048’]); // disable 2x large size…Continue reading

Add Attributes to Site Mobile Logo Image – reference

add_filter( ‘generate_mobile_header_logo_output’, function( $output ) { if ( ! function_exists( ‘generate_menu_plus_get_defaults’ ) ) { return $output; } $settings = wp_parse_args( get_option( ‘generate_menu_plus_settings’, array() ), generate_menu_plus_get_defaults() ); return sprintf( ‘ ‘, esc_url( apply_filters( ‘generate_logo_href’ , home_url( ‘/’ ) ) ), esc_attr(…Continue reading

Remove Post Title from Yoast Breadcrumb

/* Remove Post Title from Yoast Breadcrumb */ add_filter(‘wpseo_breadcrumb_single_link’, ‘remove_breadcrumb_title’ ); function remove_breadcrumb_title( $link_output) { if(strpos( $link_output, ‘breadcrumb_last’ ) !== false ) { $link_output = ”; } return $link_output; }Continue reading

Estimated reading time

// Estimated reading time function readTime ( $content = ”, $words_per_minute = 250, $with_gutenberg = false ) { // In case if content is build with gutenberg parse blocks if ( $with_gutenberg ) { $blocks = parse_blocks( $content ); $contentHtml…Continue reading

Remove Default jQuery

// Remove default WordPress jquery wp_deregister_script( ‘jquery’ ); //Remove jquery migrate add_action( ‘wp_default_scripts’, ‘remove_jquery_migrate’ ); function remove_jquery_migrate( $scripts ) { if ( ! is_admin() && isset( $scripts->registered[‘jquery’] ) ) { $script = $scripts->registered[‘jquery’]; if ( $script->deps ) { $script->deps =…Continue reading

Remove Post Title from Yoast Breadcrumbs

// Remove post title from yoast breadcrumbs add_filter(‘wpseo_breadcrumb_single_link’, function( $link_output) { if( strpos( $link_output, ‘breadcrumb_last’ ) !== false ) { $link_output = ”; } return $link_output; } );Continue reading

Disable Auto-generated Image Sizes

// Disable Auto Generated Images Sizes add_action(‘intermediate_image_sizes_advanced’, ‘disable_image_sizes’); function disable_image_sizes($sizes) { //unset($sizes[‘thumbnail’]); //unset($sizes[‘medium’]); //unset($sizes[‘large’]); unset($sizes[‘medium_large’]); unset($sizes[‘1536×1536’]); unset($sizes[‘2048×2048’]); return $sizes; } add_action(‘init’, ‘disable_other_image_sizes’); function disable_other_image_sizes() { remove_image_size(‘post-thumbnail’); remove_image_size(‘another-size’); } add_filter(‘big_image_size_threshold’, ‘__return_false’);Continue reading

Use Full Store Address in Ships From

add_filter( ‘wcv_product_ships_from’, ‘ships_from_address’ ); function ships_from_address( $field ){ global $post, $product; $shipping_disabled = wc_string_to_bool( get_option( ‘wcvendors_shipping_management_cap’, ‘no’ ) ); $post = get_post( $product->get_id() ); if ( $product->needs_shipping() && ! $shipping_disabled && WCV_Vendors::is_vendor( $post->post_author ) ) { $vendor_id = WCV_Vendors::get_vendor_from_product( $product->get_id()…Continue reading